Boost logo

Boost :

Subject: Re: [boost] Boost Range Joined Range
From: Ali NakipoÄŸlu (nakipogluali_at_[hidden])
Date: 2012-10-02 02:16:09


Thank you ver much Nate.

Very good idea!

Best,
Ali

Sent from my iPad

On Oct 1, 2012, at 11:45 PM, Nathan Ridge <zeratul976_at_[hidden]> wrote:

>
>> How can i create copy a joined_range type and it contents? Any alternatives
>> to make this?
>>
>> For example
>>
>> typedef std::vector<int> VectorT;
>> typedef joined_range< VectorT, VectorT> JoinedRangeT;
>>
>> VectorT vector0, vector1;
>>
>> JoinedRangeT joinedRange0( vector0, vector1 )
>>
>> // I need this
>> JoinedRangeT joinedRange1 = copyAnyRangeOrContainer( joinedRange0 );
>>
>> Im planning to use your advices to design copyAnyRangeOrContainer function,
>> so that it can create deep copies from given range or containers that are
>> can be vector,map, joined_range<T1,T2> or even
>> joined_range<joined_range<T1,T2>, joined_range<T1, T2> >
>
> Is it important that the return type of copyAnyRangeOrContainer be the
> same type as its argument? It seems to me that, since you're deep copying
> the elements anyways, you might as well have it return a specific range
> (e.g. std::vector) for all input types, in which case it can be implemented
> like so:
>
> template <typename RangeT>
> std::vector<typename range_value<RangeT>::value>
> copyAnyRangeOrContainer(const RangeT& input)
> {
> std::vector<typename range_value<RangeT>::value> result;
> push_back(result, input);
> return result;
> }
>
> Regards,
> Nate
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk