improve std::deque::_M_reallocate_map
Michael Matz
matz@suse.de
Tue Nov 26 16:51:01 GMT 2024
Hello,
On Tue, 26 Nov 2024, Jonathan Wakely wrote:
> So the 'const int' doesn't really matter for any -On level, as you
> say, but just avoiding two separate uses of the __deque_buf_size
> function is worthwhile for -std=c++98 -O0
Oh, definitely. Avoiding duplicate calls in C++ sources (no matter which
version) is always good, even if for nothing else than to avoid parsing
two call expressions in later versions ;-)
> You were right to be triggered, I was wrong to say that making it a
> constant expression mattered. For C++98 it's not a constant expression
> (because the function is just 'inline' but not 'constexpr') and for
> C++11 the fact it's 'constexpr' is enough for it to be constant-folded
> whether the LHS is const or not.
Cool cool, thanks again for bearing with me!
Ciao,
Michael.
More information about the Libstdc++
mailing list