Boost logo

Boost :

From: Roman Yakovenko (roman.yakovenko_at_[hidden])
Date: 2005-06-27 06:37:26


> From: Pavel Chikulaev [mailto:pavel.chikulaev_at_[hidden]]
>
> Hi all,
>
> Is there any interest in tagged tuple as extension of tuples
> library or fusion
> library?
> The example:
>
> struct name_t {}; //tagged types
> struct year_t {};
>
> void foo()
> {
> tagged_tuple<std::string, name_t, int, year_t> s;
>
> s.get<name_t>() = "Hello World"!;
> s.get<year_t>() = 2005;
> assert(s.get<0>() == s.get<name_t>());
> assert(s.get<1>() == s.get<year_t>());
> }
>
> It already works in VC7.1 and VC8.0 :)
>
> What do you think?

If you try to solve code readability then adding simple enum, even unnamed, solves the problem

enum { name, year };

s.get<name>()

If you try to solve an other problem, please describe the problem first.
And second this has been already discussed on the list. One of the objections
was the use case where you have same type occurs more then once in tuple.

tagged_tuple<std::string, name_t, std::string, name_t > s;

s.get<name_t>() - is this operation defined and what it's result

> Pavel Chikulaev

Roman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk