|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2002-11-01 22:54:41
"Joel de Guzman" <djowel_at_[hidden]> wrote in message
news:01ce01c28215$891a1ff0$0100a8c0_at_kim...
> BTW, if you wish to have the tup.field syntax, you might find
> inspiration in boost.spirit closures. Example syntax:
>
> struct my_tuple : tuple_fields<my_tuple, std::string, int, int>
> {
> member1 name;
> member2 id;
> member3 age;
> };
>
> Then:
>
> my_tuple tup;
> std::cout << tup.name << std::endl;
>
> see http://spirit.sourceforge.net/index.php?doc=docs/v1_5/closures.html
Here you explicitly define your fields, which makes impossible something
like projection or cross-product.
As far as boost::tuple is concerned, I need some time to consider pros and
cons.
By the way, what are the objections against our current approach? One, as I
understand, the need for macro. Another is that boost::tuple is already
widely used throughout the library. Anything else?
Just to re-iterate, we currently define a class for every column. This
class contains a placeholder for the value. The name of this class serves
as the column name. Columns (classes) get combined in a typelist, which is
passed to the tuple, which inherits from all of them. Static_cast is used
to access individual fields.
Regards,
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk