21#include <boost/version.hpp>
22#if BOOST_VERSION >= 107400
23#include <boost/serialization/library_version_type.hpp>
25#include <boost/serialization/nvp.hpp>
26#include <boost/serialization/set.hpp>
34namespace serialization {
48template<
typename VALUE>
49class FastSet:
public std::set<VALUE, std::less<VALUE>,
50 typename internal::FastDefaultAllocator<VALUE>::type> {
56 typedef std::set<VALUE, std::less<VALUE>,
57 typename internal::FastDefaultAllocator<VALUE>::type> Base;
64 template<
typename INPUTCONTAINER>
65 explicit FastSet(
const INPUTCONTAINER& container) :
66 Base(container.begin(), container.end()) {
79#ifdef GTSAM_ALLOCATOR_BOOSTPOOL
81 FastSet(
const std::set<VALUE>& x) {
86 Base::insert(x.begin(), x.end());
91 operator std::set<VALUE>()
const {
92 return std::set<VALUE>(this->begin(), this->end());
97 return this->find(e) != this->end();
101 void print(
const std::string& str =
"")
const {
102 for (
typename Base::const_iterator it = this->begin(); it != this->end(); ++it)
108 typename Base::const_iterator it1 = this->begin(), it2 = other.begin();
109 while (it1 != this->end()) {
120 Base::insert(other.begin(), other.end());
126 template<
class ARCHIVE>
127 void serialize(ARCHIVE & ar,
const unsigned int ) {
128 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
An easy way to control which allocator is used for Fast* collections.
Concept check for values that can be used in unit tests.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
FastSet is a thin wrapper around std::set that uses the boost fast_pool_allocator instead of the defa...
Definition: FastSet.h:50
void merge(const FastSet &other)
insert another set: handy for MATLAB access
Definition: FastSet.h:119
void print(const std::string &str="") const
Print to implement Testable: pretty basic.
Definition: FastSet.h:101
FastSet(const INPUTCONTAINER &container)
Constructor from a iterable container, passes through to base class.
Definition: FastSet.h:65
FastSet(const FastSet< VALUE > &x)
Copy constructor from another FastSet.
Definition: FastSet.h:70
bool exists(const VALUE &e) const
Handy 'exists' function.
Definition: FastSet.h:96
bool equals(const FastSet< VALUE > &other, double tol=1e-9) const
Check for equality within tolerance to implement Testable.
Definition: FastSet.h:107
friend class boost::serialization::access
Serialization function.
Definition: FastSet.h:125
FastSet(const Base &x)
Copy constructor from the base set class.
Definition: FastSet.h:75
FastSet()=default
Default constructor.
A testable concept check that should be placed in applicable unit tests and in generic algorithms.
Definition: Testable.h:58