This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] C++14: N3671 Making non-modifying sequence operations more robust


On 15 June 2013 16:48, Jonathan Wakely wrote:
> On 11 June 2013 00:11, Jonathan Wakely wrote:
>> On 10 June 2013 23:08, Chris Jefferson wrote:
>>> After we are in the 'if(__ra_iters)' case, and checked that __d1==__d2,
>>> could dispatch to old-fashioned equal(__first1, __last1, __first2,
>>> __binary_pred). This has the advantage that it saves repeatedly checking
>>> __first2 != __last2 unnessasairly, and I suspect only having one loop
>>> condition to check will give the compiler a better shot at optimising /
>>> unrolling (although, I haven't checked that I will admit).
>>
>> Good idea, thanks, I'll make that change too.
>
> How's this?  I made both the new std::equal() overloads defer to the
> old ones when both sets of iterators are random access.  That means
> there's no need for the __equal2 class template, the memcmp special
> case for pointers is handled by the old std::equal().

I'm committing the attached, which also fixes some silly typos in the
new is_permutation overloads.

Tested x86_64-linux.

2013-06-17  Jonathan Wakely  <jwakely.gcc@gmail.com>
            Chris Jefferson  <chris@bubblescope.net>

        * include/bits/stl_algobase.h (equal): Make C++14 overloads from N3671
        dispatch to traditional std::equal for random-access iterators.
        (__equal2_aux, __equal2): Remove.
        (__equal::equal): Remove unused overloads.
        * include/bits/stl_algo.h (is_permutation): Fix typos.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]