Avoids std::distance calls
Jonathan Wakely
jwakely@redhat.com
Mon Jun 4 21:09:00 GMT 2018
On 04/06/18 22:13 +0200, François Dumont wrote:
>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.
Just one place, in __inplace_merge, no?
>I don't think there is any abi concern for this inline constructor,
>isn't there ?
No concerns, users can't explicitly instantiate that type, and it will
be inlined or generate an instantiation everywhere it's used.
>Â Â Â * 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 ?
OK, thanks.
More information about the Libstdc++
mailing list