Is there, perhaps in boost, consistent element access semantics which works across containers?
something along the lines of:
element_of(std_pair).get<1>();
element_of(boost_tuple).get<0>();
element_of(pod_array).get<2>();
in principle i can write myself, but I would rather not reinvent the wheel.thanks
I’m not aware of such a thing.
You could most probably just implement a free get function for the types you’re interested in. Boost.Tuple already has it.
std::pairhas it in C++0x. And the rest shouldn’t be too complicated.E.g