Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-09-29 05:28:10

----Original Message----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Joel de Guzman
Sent: 29 September 2006 00:25 To: boost_at_[hidden]
Subject: Re: [boost] [fusion] Support for classic boost::tuple

> David Abrahams wrote:
>> Joel de Guzman <joel_at_[hidden]> writes:
>>> David Abrahams wrote:
>>>> Joel de Guzman <joel_at_[hidden]> writes:
>>>>> Hi,
>>>>> Ok, as promised. Support for classic boost::tuple has been added.
>>>>> Now yer ole boost tuples are full fusion citizens. Now
>>>>> boost::tuple can do for_each, transform, fold, find,
>>>>> assign/convert to other fusion sequences, etc.
>>>>> Now there are 3 adapted sequences:
>>>>> 1) std::pair
>>>> This one is going to cause me issues. I'm writing a unified
>>>> library to operate on static and dynamic sequences. Here's the
>>>> issue: is
>>>> pair<int*,int*>
>>>> a dynamic sequence that goes from the first pointer to the 2nd (as
>>>> in Boost.Range), or a static sequence with 2 elements (a la
>>>> Fusion)?
>>> Both? I think, in as much as boost::array<int> is a dynamic
>>> sequence that STL algorithms can operate on, and at the same
>>> time, is also a static sequence fusion algorithms can handle,
>>> the same should be true for mono-sequences like pair<int*,int*>.
>> [what's a mono-sequence?]
> The opposite of hetero-sequence :P
>> It's not the same thing at all. In the case of array<int>, the
>> sequence has the same elements in either case; we're just talking
>> about two ways of accessing the same sequence. In the case of
>> std::pair there are two completely distinct interpretations, either
>> of which could be valid. In my case I think there are only two
>> possible choices:
>> 1. say that std::pair needs to be wrapped or otherwise
>> transformed before I know how to treat it.
>> 2. pick one of the two interpretations.
> I'm sorry. I think I'm lost. With:
> pair<int*,int*>
> or
> tuple<int*,int*,int*,int*>
> or
> array<int*>
> I see the same elements. What am I missing?
> Cheers,

I think the problem is, should
        pair<int*,int*> a_pair_of_pointers;

be treated the same as
        int* two_pointers[2];
or the same as
        int an_array_of_ints[ pair.second-pair.first ]

The first is the obvious answer if you treat the pair as a special form
of tuple. The second is the obvious answer is you consider the pair as
two iterators over a sequence (like the Boost Range library).

Martin Bonner
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 203894

Boost list run by bdawes at, gregod at, cpdaniel at, john at