improve std::deque::_M_reallocate_map

Marc Glisse marc.glisse@inria.fr
Tue Nov 26 18:16:08 GMT 2024


On Tue, 26 Nov 2024, Jonathan Wakely wrote:

>>> In the bla() example above, the call bla() is a constant expression
>>> when used to initialize a const int, so the compiler is required to
>>> evaluate it at compile time.
>>
>> When used in contexts that doesn't require an integral constant I think a
>> distinction between evaluating at compile time or at run time can't be
>> observed.
>
> Agreed.

Can't be observed might be a bit strong?

constexpr int f(){
   if consteval {return 1;} else {return 2;}
}
int main(){
   int a=f();
   const int b=f();
   return a+b;
}

returns 3 (and clang agrees).

-- 
Marc Glisse


More information about the Libstdc++ mailing list