I do not know about that.
Most likely, you can simply implement the free receipt function for the types you are interested in. Boost.Tuple already has this. std::pair has it in C ++ 0x. And the rest should not be too complicated.
eg
#include <iostream> #include <utility> #include <vector> #include <boost/tuple/tuple.hpp> namespace getter { template <size_t Index, class Container> typename Container::reference get(Container& c) { return c[Index]; } template <size_t Index, class Container> typename Container::const_reference get(const Container& c) { return c[Index]; } template <size_t Index, class T> T& get(T *arr) { return arr[Index]; } namespace detail { template <size_t Index, class T, class U> struct PairTypeByIndex; template <class T, class U> struct PairTypeByIndex<0u, T, U> { typedef T type; type& operator()(std::pair<T, U>& p) const { return p.first; } const type& operator()(const std::pair<T, U>& p) const { return p.first; } }; template <class T, class U> struct PairTypeByIndex<1u, T, U> { typedef U type; type& operator()(std::pair<T, U>& p) const { return p.second; } const type& operator()(const std::pair<T, U>& p) const { return p.second; } }; } template <size_t Index, class T, class U> typename detail::PairTypeByIndex<Index, T, U>::type& get(std::pair<T, U>& p) { return detail::PairTypeByIndex<Index, T, U>()(p); } template <size_t Index, class T, class U> const typename detail::PairTypeByIndex<Index, T, U>::type& get(const std::pair<T, U>& p) { return detail::PairTypeByIndex<Index, T, U>()(p); } using boost::get; } int main() { boost::tuple<int, int> tuple(2, 3); std::cout << getter::get<0>(tuple) << '\n'; std::vector<int> vec(10, 1); vec[2] = 100; std::cout << getter::get<2>(vec) << '\n'; const int arr[] = {1, 2, 3, 4, 5}; std::cout << getter::get<4>(arr) << '\n'; std::pair<int, float> pair(41, 3.14); ++getter::get<0>(pair); const std::pair<int, float> pair_ref = pair; std::cout << getter::get<0>(pair_ref) << ' ' << getter::get<1>(pair_ref) << '\n'; }