How do I get a reference to a "get"-function for a specific tuple instance?
My best try is given below but does not compile against g++4.5.1
#include <tuple>
#include <string>
typedef std::tuple<int,std::string> Tuple;
auto t=(std::string& (Tuple&))(std::get<1,Tuple>);
The compiler error is:
a.cc:5: error: invalid cast to function type ‘std::string&(Tuple&)’
a.cc:5: error: unable to deduce ‘auto’ from ‘<expression error>’
I would like to use the function reference as an input to some stl-algorithms. I am actually a bit surprised on how non-trivial this seems to be for me.