Boost logo

Boost Users :

Subject: Re: [Boost-users] [iterators][range][rangeex] range concatenation
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-04-07 02:49:00


Neil Groves skrev:
>
> On Mon, Apr 6, 2009 at 10:46 PM, Thorsten Ottosen
> <thorsten.ottosen_at_[hidden] <mailto:thorsten.ottosen_at_[hidden]>> wrote:
>
> Dmitry Vinogradov skrev:
>
>
> Calling process_range() twice is not a solution in my case.
> Copying references to a new container is a better way.
>
> Regarding efficiency, can you look thru my rough concat()
> implementation attached to discover any its disadvantages?
>
>
> It is undeniably more elegant than calling algorithms n times as a
> general solution. It is possible to improve performance by reordering
> some of the boolean expressions and by reducing the use of boost variant.

Right on.

>
>
> If the performance is good,this baby should be included in the range
> library asap.
>
>
> I would like to implement a new version of this functionality, since I
> have some code I had prototyped previously. I believe that the idea is
> good, but the functionality should efficiently support two random access
> iterators, and that the performance can be improved by reducing the use
> of boost::variant, although I would have to measure the variant approach
> to be certain. I can add this to the list of things to do in response to
> the Boost.RangeEx review.

Great. I'm *sure* that the variant thing adds overhead:

1. when the iterators have different size

2. because we check two times that we have a certain case:

   if( range == 0 )

also implies that we should increment a certain iterator, else another.

I wonder if we could call this beast

    join_view(r1,r2)

or something. Perhaps support for 3 and 4 ranges would be nice.

-Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net