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 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().

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]