22 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 23 #include <boost/serialization/nvp.hpp> 24 #include <boost/serialization/map.hpp> 38 template<
typename KEY,
typename VALUE>
39 class FastMap :
public std::map<KEY, VALUE, std::less<KEY>,
40 typename internal::FastDefaultAllocator<std::pair<const KEY, VALUE> >::type> {
44 typedef std::map<KEY, VALUE, std::less<KEY>,
51 template<
typename INPUTITERATOR>
52 explicit FastMap(INPUTITERATOR first, INPUTITERATOR last) : Base(first, last) {}
61 operator std::map<KEY,VALUE>()
const {
62 return std::map<KEY,VALUE>(this->begin(), this->end());
66 bool insert2(
const KEY& key,
const VALUE& val) {
return Base::insert({key, val}).second; }
69 bool exists(
const KEY& e)
const {
return this->find(e) != this->end(); }
72 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 74 friend class boost::serialization::access;
75 template<
class ARCHIVE>
76 void serialize(ARCHIVE & ar,
const unsigned int ) {
77 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:113
FastMap(INPUTITERATOR first, INPUTITERATOR last)
Definition: FastMap.h:52
Default allocator for list, map, and set types.
Definition: FastDefaultAllocator.h:49
FastMap(const Base &x)
Definition: FastMap.h:58
FastMap(const FastMap< KEY, VALUE > &x)
Definition: FastMap.h:55
Definition: chartTesting.h:28
bool exists(const KEY &e) const
Definition: FastMap.h:69
FastMap()
Definition: FastMap.h:48
An easy way to control which allocator is used for Fast* collections.
bool insert2(const KEY &key, const VALUE &val)
Definition: FastMap.h:66