Remove algo duplications

François Dumont frs.dumont@gmail.com
Tue Jun 19 19:20:00 GMT 2012


Hi

     No opinion regarding this patch ? Here is a slightly modified 
version without usage of lambda in is_heap_until implementation so that 
we use move semantic when possible.

Regards

François


On 06/12/2012 10:05 PM, François Dumont wrote:
> Hi
>
>     Here is a new version of the patch to remove duplication of algo 
> implementations.
>
>     Compared to the previous version I have rename functors that apply 
> to iterators (iter_less, iter_equal_to). I have also added move 
> semantics when iterator dereference operator returns anything except 
> lvalue reference (rvalue reference or an instance).
>
> 2012-06-12  François Dumont  <fdumont@gcc.gnu.org>
>
>     * include/bits/predefined_ops.h: New. Internal functors use to
>     avoid algorithm duplications.
>     * include/bits/stl_algobase.h, stl_algo.h, stl_heap.h: Adapt to
>     use latter functors, remove many algorithm duplications.
>     * testsuite/util/testsuite_counter_type.h: New.
>     * testsuite/25_algorithms/lower_bound/3.cc, 4.cc: New.
>
>     I don't think tests are to be added. They are not really tests but 
> rather use cases to experiment impact of the patch in different 
> situtations, with/without -fno-elide-constructors, in C++ 11 or C++98. 
> You can see in those the impact of the patch which is more or less 
> what Marc Glisse already remarked. You can see an impact mostly when 
> the iterator::reference type is not a reference, there are additional 
> copies then. But I still think this patch make sens cause it greatly 
> simplify library code.
>
>     Tested under linux x86_64.
>
> François
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: algos.patch
Type: text/x-patch
Size: 126121 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20120619/62c2c36f/attachment.bin>


More information about the Libstdc++ mailing list