|
Boost : |
From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-06-27 07:10:13
Pavel Chikulaev wrote:
> 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 :)
>
Reminds me of the mpl::inherit_linearly example:
http://www.boost.org/libs/mpl/doc/refmanual/inherit-linearly.html
(it shows a few-lines tuples implementation, using the value type as an "index").
> What do you think?
As far as I can see, the semantics you propose can be decorated easily via MPL
(set,begin,find,distance) and their use is uncommon enough to leave it an
excercise to the user. Am I missing something ?
Regards,
Tobias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk