|
Boost : |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-10-27 09:31:36
On Oct 27, 2004, at 4:22 AM, Patrick Kowalzick wrote:
> Dear all,
>
> I am not sure which version of tuples is actual and should be used:
>
> -The version in boost/tuple is working and seems consitent to the
> manual on
> the boost homepage.
>
> -The version in boost/spirit/fusion/sequence is working too and seems
> to be
> consistent to "C++ Standard Library Technical Report". tuple_size and
> tuple_element exist, which do not exist in the first version.
>
> Why are there two versions?
The former was the original Tuples library, whereas the latter was
written later according to the exact wording of the Library TR using a
different implementation technique.
> Which one shall I use?
It doesn't really matter... you may get better performance
(compile-time and run-time) out of the Fusion version, but it's also
unreviewed code. [*] I tend to use the original boost/tuple out of
habit.
> P.S.: I have another short question, and need a small hint (what to
> search
> ;) ) for kind of a "compile time for-loop".
> Something like this:
> index[0] = fw_index::template get_index< tuples::tuple_element< 0,
> TTuple>::type >();
> index[1] = fw_index::template get_index< tuples::tuple_element< 1,
> TTuple>::type >();
> ...
Todd Veldhuizen's web page on template metaprogramming might be a good
start:
http://osl.iu.edu/~tveldhui/papers/Template-Metaprograms/meta-art.html
Or, if you can hold off a few weeks, David Abrahams and Aleksey
Gurtovoy have written a more extensive book on template
metaprogramming:
http://www.awprofessional.com/title/0321227255
Doug
[*] It's undoubtedly correct code, but still...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk