Boost logo

Boost Users :

From: Hansi (hansipet_at_[hidden])
Date: 2008-05-20 05:59:58


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net