21#include <gtsam/config.h>
23#if GTSAM_ENABLE_BOOST_SERIALIZATION
24#include <boost/version.hpp>
25#if BOOST_VERSION >= 107400
26#include <boost/serialization/library_version_type.hpp>
28#include <boost/serialization/nvp.hpp>
29#include <boost/serialization/set.hpp>
38namespace serialization {
52template<
typename VALUE>
53class FastSet:
public std::set<VALUE, std::less<VALUE>,
54 typename internal::FastDefaultAllocator<VALUE>::type> {
58 typedef std::set<VALUE, std::less<VALUE>,
59 typename internal::FastDefaultAllocator<VALUE>::type> Base;
66 template<
typename INPUTCONTAINER>
67 explicit FastSet(
const INPUTCONTAINER& container) :
68 Base(container.begin(), container.end()) {
83#ifdef GTSAM_ALLOCATOR_BOOSTPOOL
85 FastSet(
const std::set<VALUE>& x) {
90 Base::insert(x.begin(), x.end());
95 operator std::set<VALUE>()
const {
96 return std::set<VALUE>(this->begin(), this->end());
101 return this->find(e) != this->end();
105 void print(
const std::string& str =
"")
const {
106 for (
typename Base::const_iterator it = this->begin(); it != this->end(); ++it)
112 typename Base::const_iterator it1 = this->begin(), it2 = other.begin();
113 while (it1 != this->end()) {
124 Base::insert(other.begin(), other.end());
128#if GTSAM_ENABLE_BOOST_SERIALIZATION
130 friend class boost::serialization::access;
131 template<
class ARCHIVE>
132 void serialize(ARCHIVE & ar,
const unsigned int ) {
133 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
FastSet is a thin wrapper around std::set that uses the boost fast_pool_allocator instead of the defa...
Definition FastSet.h:54
void merge(const FastSet &other)
insert another set: handy for MATLAB access
Definition FastSet.h:123
void print(const std::string &str="") const
Print to implement Testable: pretty basic.
Definition FastSet.h:105
FastSet(const INPUTCONTAINER &container)
Constructor from a iterable container, passes through to base class.
Definition FastSet.h:67
FastSet(const FastSet< VALUE > &x)
Copy constructor from another FastSet.
Definition FastSet.h:72
bool exists(const VALUE &e) const
Handy 'exists' function.
Definition FastSet.h:100
bool equals(const FastSet< VALUE > &other, double tol=1e-9) const
Check for equality within tolerance to implement Testable.
Definition FastSet.h:111
FastSet(const Base &x)
Copy constructor from the base set class.
Definition FastSet.h:77
FastSet()=default
Default constructor.
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37