21 #include <boost/serialization/nvp.hpp> 22 #include <boost/serialization/set.hpp> 30 namespace serialization {
44 template<
typename VALUE>
45 class FastSet:
public std::set<VALUE, std::less<VALUE>,
46 typename internal::FastDefaultAllocator<VALUE>::type> {
52 typedef std::set<VALUE, std::less<VALUE>,
53 typename internal::FastDefaultAllocator<VALUE>::type> Base;
60 template<
typename INPUTITERATOR>
61 explicit FastSet(INPUTITERATOR first, INPUTITERATOR last) :
66 template<
typename INPUTCONTAINER>
67 explicit FastSet(
const INPUTCONTAINER& container) :
68 Base(container.begin(), container.end()) {
81 #ifdef GTSAM_ALLOCATOR_BOOSTPOOL 83 FastSet(
const std::set<VALUE>& x) {
88 Base::insert(x.begin(), x.end());
93 operator std::set<VALUE>()
const {
94 return std::set<VALUE>(this->begin(), this->end());
99 return this->find(e) != this->end();
103 void print(
const std::string& str =
"")
const {
104 for (
typename Base::const_iterator it = this->begin(); it != this->end(); ++it)
110 typename Base::const_iterator it1 = this->begin(), it2 = other.begin();
111 while (it1 != this->end()) {
122 Base::insert(other.begin(), other.end());
127 friend class boost::serialization::access;
128 template<
class ARCHIVE>
129 void serialize(ARCHIVE & ar,
const unsigned int ) {
130 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
FastSet(INPUTITERATOR first, INPUTITERATOR last)
Constructor from a range, passes through to base class.
Definition: FastSet.h:61
FastSet(const FastSet< VALUE > &x)
Copy constructor from another FastSet.
Definition: FastSet.h:72
void print(const std::string &str="") const
Print to implement Testable: pretty basic.
Definition: FastSet.h:103
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Definition: Testable.h:57
FastSet(const Base &x)
Copy constructor from the base set class.
Definition: FastSet.h:77
FastSet()
Default constructor.
Definition: FastSet.h:56
An easy way to control which allocator is used for Fast* collections.
bool equals(const FastSet< VALUE > &other, double tol=1e-9) const
Check for equality within tolerance to implement Testable.
Definition: FastSet.h:109
void merge(const FastSet &other)
insert another set: handy for MATLAB access
Definition: FastSet.h:121
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Concept check for values that can be used in unit tests.
FastSet(const INPUTCONTAINER &container)
Constructor from a iterable container, passes through to base class.
Definition: FastSet.h:67
bool exists(const VALUE &e) const
Handy 'exists' function.
Definition: FastSet.h:98