Hi,
is there some utility (templated) adapter type class that I could use to
construct an adapter such that an (associative) array of (pointers to) objects
behaves like an (associative) array of a member variable of the objects?
Something like
class A {
int val;
};
std::map container_type;
container_type amap;
shared_ptr<A> elem(new A());
amap[2] = elem;
amap[4] = elem;
amap[6] = elem;
selector_adapter val_container(&amap);
std::cout << val_container[4]; // should output amap[4]->val;
--nico
--
nico galoppo von borries @ address: 105 creel st., chapel hill
comp. graphics phd. student @ north carolina, 27516 USA
UNC, chapel hill @ phone: +1 (919) 962-1898 (office)
@ +1 (919) 942-7609 (home)
@ email: nico at cs dot unc dot edu
@ homepage: http://www.cs.unc.edu/~nico
--- debian linux :: vim powered