From 43bae4dc2f5994db2385bb8f6b796787876ccee9 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Thu, 8 Nov 2018 00:58:30 -0500 Subject: [PATCH] Added explicit to constructors --- gtsam/base/FastVector.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gtsam/base/FastVector.h b/gtsam/base/FastVector.h index 7d1cb970c..3616704f7 100644 --- a/gtsam/base/FastVector.h +++ b/gtsam/base/FastVector.h @@ -35,9 +35,7 @@ namespace gtsam { template class FastVector: public std::vector::type> { - -public: - + public: typedef std::vector::type> Base; @@ -66,13 +64,13 @@ public: } /** Copy constructor from the base class */ - FastVector(const Base& x) : + explicit FastVector(const Base& x) : Base(x) { } /** Copy constructor from a standard STL container */ template - FastVector(const std::vector& x) { + explicit FastVector(const std::vector& x) { // This if statement works around a bug in boost pool allocator and/or // STL vector where if the size is zero, the pool allocator will allocate // huge amounts of memory. @@ -85,14 +83,12 @@ public: return std::vector(this->begin(), this->end()); } -private: + private: /** Serialization function */ friend class boost::serialization::access; template void serialize(ARCHIVE & ar, const unsigned int /*version*/) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base); } - }; - -} +} // namespace gtsam