20 May 11:59
tuple type question
From: Hansi <hansipet <at> web.de>
Subject: tuple type question
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-05-20 09:59:58 GMT
Subject: tuple type question
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-05-20 09:59:58 GMT
Hello,
at the moment I want to make a getter function for a tuple type. The
tuple is internally hidden in a class. For that I want to make a
function which returns the values inside the tuple. The best solution
would be if I can make a enum which defines the position inside the
tuple and a template function which returns the value for this tuple.
I have tested the following, but it doesn't work:
typedef struct Members
{
enum Member
{
name = 0,
value = 1,
};
}Members;
template<enum Member member>
element<0, Properties::Property>::type name()(const
boost::tuples::tuple<std::wstring, boost::any>& prop)
{
return boost::tuples::get<member>(prop);
}
Can anyone give my an hint? I'm not very familiar with the
metaprogramming things...
Best regards
Hansjörg
RSS Feed