From ea953a3d452eead04862cac64b94e5452f92b878 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Thu, 8 Nov 2018 22:32:39 -0500 Subject: [PATCH] Removed old FastVector code. --- gtsam/base/FastVector.h | 82 ++++------------------------------------- 1 file changed, 7 insertions(+), 75 deletions(-) diff --git a/gtsam/base/FastVector.h b/gtsam/base/FastVector.h index 46bc25642..e54b91126 100644 --- a/gtsam/base/FastVector.h +++ b/gtsam/base/FastVector.h @@ -11,8 +11,9 @@ /** * @file FastVector.h - * @brief A thin wrapper around std::vector that uses boost's pool_allocator. + * @brief A thin wrapper around std::vector that uses a custom allocator. * @author Richard Roberts + * @author Frank Dellaert * @date Feb 9, 2011 */ @@ -23,82 +24,13 @@ namespace gtsam { -#ifndef GTSAM_USE_OLD_FAST_VECTOR - -template -using FastVector = std::vector::type>; - -#else - -#include -#include - /** - * FastVector is a thin wrapper around std::vector that uses the boost - * pool_allocator instead of the default STL allocator. This is just a - * convenience to avoid having lengthy types in the code. Through timing, - * we've seen that the pool_allocator can lead to speedups of several % + * FastVector is a type alias to a std::vector with a custom memory allocator. + * The particular allocator depends on GTSAM's cmake configuration. * @addtogroup base */ -template -class FastVector: public std::vector::type> { - public: - typedef std::vector::type> Base; - - /** Default constructor */ - FastVector() { - } - - /** Constructor from size */ - explicit FastVector(size_t size) : - Base(size) { - } - - /** Constructor from size and initial values */ - explicit FastVector(size_t size, const VALUE& initial) : - Base(size, initial) { - } - - /** Constructor from a range, passes through to base class */ - template - explicit FastVector(INPUTITERATOR first, INPUTITERATOR last) { - // 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. - if (first != last) - Base::assign(first, last); - } - - /** Copy constructor from the base class */ - FastVector(const Base& x) : - Base(x) { - } - - /** Copy constructor from a standard STL container */ - template - 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. - if (x.size() > 0) - Base::assign(x.begin(), x.end()); - } - - /** Conversion to a standard STL container */ - operator std::vector() const { - return std::vector(this->begin(), this->end()); - } - - private: - /** Serialization function */ - friend class boost::serialization::access; - template - void serialize(ARCHIVE & ar, const unsigned int /*version*/) { - ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base); - } -}; -#endif +template +using FastVector = + std::vector::type>; } // namespace gtsam