From: David Abrahams (dave_at_[hidden])
Date: 2002-12-16 18:54:06
Terje Slettebø <tslettebo_at_[hidden]> writes:
>>From: "David A. Greene" <greened_at_[hidden]>
>> Rozental, Gennadiy wrote:
>> >>Which example is that? Is inherit_linearly documented somewhere?
>> > inherit_linearly.cpp?rev=1.1&content-type=text/vnd.viewcvs-markup
>> Well, that's not creating a boost::tuple. :) I could certainly use
>> mpl::fold or some similar algorithm to create boost::tuple<int,
>> boost::tuple<...> > > > but I'm not sure that "really" a boost::tuple
>> either. cons<int, cons<...> > > > might be closer.
Yes, in fact, the cons< ... > structure satisfies all the requirements
for a tuple. boost::tuple is just a friendly wrapper which presents
an easy interface.
> Here's one way. This handles tuples of up to three elements, but can easily
> be extended.
> It requires partial specialisation, but it could also be rewritten without
> it. In fact, I wrote a more complex version without it first, using
> compile-time if-else, but then realised I could use specialisations for
The version using fold<> is sure to be shorter and more-general!
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk