22#include <boost/serialization/nvp.hpp>
23#include <boost/serialization/map.hpp>
36template<
typename KEY,
typename VALUE>
37class FastMap :
public std::map<KEY, VALUE, std::less<KEY>,
38 typename internal::FastDefaultAllocator<std::pair<const KEY, VALUE> >::type> {
42 typedef std::map<KEY, VALUE, std::less<KEY>,
49 template<
typename INPUTITERATOR>
50 explicit FastMap(INPUTITERATOR first, INPUTITERATOR last) : Base(first, last) {}
59 operator std::map<KEY,VALUE>()
const {
60 return std::map<KEY,VALUE>(this->begin(), this->end());
64 bool insert2(
const KEY& key,
const VALUE& val) {
return Base::insert(std::make_pair(key, val)).second; }
67 bool exists(
const KEY& e)
const {
return this->find(e) != this->end(); }
72 template<
class ARCHIVE>
73 void serialize(ARCHIVE & ar,
const unsigned int ) {
74 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
An easy way to control which allocator is used for Fast* collections.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Default allocator for list, map, and set types.
Definition: FastDefaultAllocator.h:50
FastMap(const Base &x)
Copy constructor from the base map class.
Definition: FastMap.h:56
FastMap(INPUTITERATOR first, INPUTITERATOR last)
Constructor from a range, passes through to base class.
Definition: FastMap.h:50
bool insert2(const KEY &key, const VALUE &val)
Handy 'insert' function for Matlab wrapper.
Definition: FastMap.h:64
FastMap(const FastMap< KEY, VALUE > &x)
Copy constructor from another FastMap.
Definition: FastMap.h:53
FastMap()
Default constructor.
Definition: FastMap.h:46
bool exists(const KEY &e) const
Handy 'exists' function.
Definition: FastMap.h:67
friend class boost::serialization::access
Serialization function.
Definition: FastMap.h:71