c++ - How to have: map<T, vector<iterator to map itself> >? -
i need map
keys of composite type t
vector of iterators of map itself.
(e.g., think of graph in every node holds iterators point parents.)
the reason i'm avoiding storing parents' keys values keys expensive objects, i'd store iterators instead.
is such thing possible?
if not, what's best alternative?
(i know can use polymorphism , type erasure brute-force way solve this, i'm wondering if there's better way.)
due 23.2.1 general container requirements:
containers objects store other objects. control allocation , deallocation of these objects through constructors, destructors, insert , erase operations.
hence possible:
struct key; struct value; typedef std::map<key, value> map; struct key {}; struct value { std::vector<map::iterator> parents; };
(all types , sizes known)
Comments
Post a Comment