Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
dtho
on Sept 8, 2023
|
parent
|
context
|
favorite
| on:
Just how constexpr is C++20’s std:string?
The
constructor
of std::string is constexpr in C++20. A runtime call to 'strlen' (or equivalent) can be optimized out by computing the string's length at compile time and initializing the object accordingly.
rewmie
on Sept 9, 2023
[–]
> The constructor of std::string is constexpr in C++20.
If I recall correctly, from C++20 onward all member functions of std::string are constexpr.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: