FastList.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
22 #include <list>
23 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
24 #include <boost/serialization/nvp.hpp>
25 #include <boost/serialization/version.hpp>
26 #if BOOST_VERSION >= 107400
27 #include <boost/serialization/library_version_type.hpp>
28 #endif
29 #include <boost/serialization/list.hpp>
30 #endif
31 
32 namespace gtsam {
33 
42 template<typename VALUE>
43 class FastList: public std::list<VALUE, typename internal::FastDefaultAllocator<VALUE>::type> {
44 
45 public:
46 
48 
50  FastList() {}
51 
53  template<typename INPUTITERATOR>
54  explicit FastList(INPUTITERATOR first, INPUTITERATOR last) : Base(first, last) {}
55 
58 
60  FastList(const Base& x) : Base(x) {}
61 
63  FastList(std::initializer_list<VALUE> l) : Base(l) {}
64 
65 #ifdef GTSAM_ALLOCATOR_BOOSTPOOL
66 
67  FastList(const std::list<VALUE>& x) {
68  // This if statement works around a bug in boost pool allocator and/or
69  // STL vector where if the size is zero, the pool allocator will allocate
70  // huge amounts of memory.
71  if(x.size() > 0)
72  Base::assign(x.begin(), x.end());
73  }
74 #endif
75 
77  operator std::list<VALUE>() const {
78  return std::list<VALUE>(this->begin(), this->end());
79  }
80 
81 private:
82 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
83 
84  friend class boost::serialization::access;
85  template<class ARCHIVE>
86  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
87  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
88  }
89 #endif
90 
91 };
92 
93 }
gtsam.examples.DogLegOptimizerExample.type
type
Definition: DogLegOptimizerExample.py:111
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
gtsam::FastList::FastList
FastList(std::initializer_list< VALUE > l)
Construct from c++11 initializer list:
Definition: FastList.h:63
Eigen::last
static const symbolic::SymbolExpr< internal::symbolic_last_tag > last
Definition: IndexedViewHelper.h:38
gtsam::FastList::Base
std::list< VALUE, typename internal::FastDefaultAllocator< VALUE >::type > Base
Definition: FastList.h:47
l
static const Line3 l(Rot3(), 1, 1)
gtsam::FastList
Definition: FastList.h:43
anyset::size
size_t size() const
Definition: pytypes.h:2220
gtsam::FastList::FastList
FastList(const Base &x)
Definition: FastList.h:60
gtsam::FastList::FastList
FastList(INPUTITERATOR first, INPUTITERATOR last)
Definition: FastList.h:54
gtsam
traits
Definition: SFMdata.h:40
FastDefaultAllocator.h
An easy way to control which allocator is used for Fast* collections.
Eigen::placeholders::end
static const EIGEN_DEPRECATED end_t end
Definition: IndexedViewHelper.h:181
Base
Definition: test_virtual_functions.cpp:156
gtsam::FastList::FastList
FastList()
Definition: FastList.h:50
gtsam::FastList::FastList
FastList(const FastList< VALUE > &x)
Definition: FastList.h:57


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:17