SYNOPSYS
A class for: l = {(0,3.3),...(7,8.2)} i.e. a wrapper for STL map<size_t,T> with some assignment operators, such as l1 += l2. This class is suitable for use with the disarray<T> class, as disarray<pair_set> (see disarray(2)).
TODO
template <T,A> with A=std::allocator or heap_allocator
IMPLEMENTATION
template<class T, class A = std::allocator<std::pair<std::size_t,T> > > class pair_set: public std::map<std::size_t, T, std::less<std::size_t>, A> { public: // typedefs: typedef std::size_t size_type; typedef std::pair<size_type,T> pair_type; typedef std::pair<const size_type,T> const_pair_type; typedef pair_type value_type; typedef A allocator_type; typedef std::map<size_type, T, std::less<size_type>, allocator_type> base; typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; // allocators: pair_set (const A& alloc = A()); pair_set (const pair_set<T,A>& x, const A& alloc = A()); pair_set<T,A>& operator= (const pair_set<T,A>& x); void clear (); // basic algebra: semantic of a sparse vector pair_set<T,A>& operator+= (const pair_type& x); // c := a union {x} template<class B> pair_set<T,A>& operator+= (const pair_set<T,B>& b); // c := a union b // boost mpi: template <class Archive> void serialize (Archive& ar, const unsigned int version); }; // io: template <class T, class A> std::istream& operator>> (std::istream& is, pair_set<T,A>& a); template <class T, class A> std::ostream& operator<< (std::ostream& os, const pair_set<T,A>& b);