Avoids std::distance calls

François Dumont frs.dumont@gmail.com
Mon Jun 4 20:13:00 GMT 2018


Hi

I'd like to propose this patch to avoid std::distance calls. In a number 
of situation in algos we already have the size of the buffer we need so 
we shouldn't have to compute it again.

I don't think there is any abi concern for this inline constructor, 
isn't there ?

     * include/bits/stl_tempbuf.h
     (_Temporary_buffer(_FwdIte, _FwdIte)): Delete, replaced by...
     (_Temporary_buffer(_FwdIte, size_type)): ...this, new.
     * include/ext/memory (temporary_buffer<>(_FwdIte, _FwdIte)): Adapt.
     * include/bits/stl_algo.h (__stable_partition): Adapt.
     (__inplace_merge): Adapt.
     (__stable_sort): Adapt.

Tested under Linux x86_64 normal mode.

Ok to commit ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp_buffer.patch
Type: text/x-patch
Size: 3471 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180604/89adca3c/attachment.bin>


More information about the Libstdc++ mailing list