22 May 19:42
Re: tuple type question
From: Olaf Peter <ope-devel <at> gmx.de>
Subject: Re: tuple type question
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-05-22 17:42:21 GMT
Subject: Re: tuple type question
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-05-22 17:42:21 GMT
Hi,
> struct Test
> {
> typedef boost::tuple<int,char> tuple_t;
> tuple_t tup;
> enum Members { NAME, VALUE };
>
> typename boost::tuples::element<NAME, tuple_t>::type
> name()
> { return boost::get<NAME>(tup); }
> };
why not simple derive:
struct Test
: boost::tuple<int,char>
{
enum Members { NAME, VALUE };
};
Than you have the tuple calling syntax:
get<Test::Name>( ... )
That's what I use for reading and writing "named" tuples.
Regards,
Olaf
RSS Feed