(Previous discussion (C++17): #16684)
With package managers shipping newer versions of compilers and older releases of operating systems going EOL, it occurs that at some point in the future it will be almost uncontroversial to switch to C++20.
See the new features here: https://en.cppreference.com/w/cpp/compiler_support#cpp20
I think noteworthy are:
- Lambdas in unevaluated contexts: It will be possible to use
Assert(...)
(a lambda) inside another lambda. (Already fixed by #24714 ) - Designated initializers: Named arguments for constructors, see also #20487 (review) (Already fixed by #24531)
- std::span: Replacing our
Span
, see also #23226 - Epoch for std::chrono: Being able to remove
ChronoSanityCheck
from #21110 - Remove gmtime, #27233 (review)
- Some better deduction guides (e.g. https://github.com/bitcoin/bitcoin/blob/16d698cdcf3c4ef34bae4ccd616d0ddc4a7165d4/src/util/overloaded.h#L18 )
- “Key equivalence stuff” (?) from #19677
- consteval #26960 (comment)
- concepts #27927 (review)
- https://github.com/bitcoin/bitcoin/pull/27401
- https://github.com/bitcoin/bitcoin/pull/28065#discussion_r1262934214
- serialize changes: #25284 (review) #25284 (review) and #23363 (comment)
Overall this doesn’t look like massive improvements, so switching to C++20 is probably low(est) priority.