C++ Logo

std-proposals

Advanced search

[std-proposals] Expanding constinit

From: <yang.franklin9_at_[hidden]>
Date: Fri, 26 Jan 2024 01:42:05 -0800
Hello all,
 
Currently, constinit can only apply to static or thread storage duration. I
propose it should also be applicable to automatic storage duration.
 
Furthermore, const member variables of constinit objects will be constant
expressions (which would also make getter functions of these members
constant).
 
These changes should be beneficial in ensuring that construction has no
runtime overhead, and could potentially also open up new possibilities with
non-static constexpr fields.
 
Any thoughts?
 
Best Regards,
Franklin Yang

Received on 2024-01-26 09:42:09