Things C++26 define_static_array can't do

We’ve seen previously
that it’s not possible to create a constexpr global variable of container type,
when that container holds a pointer to a heap allocation. It’s fine to create a
global constexpr std::array, or even a std::string that uses only its SSO buffer;
but you can’t create a global constexpr std::vector or std::list (unless it’s
empty) because it would have to hold a pointer to a heap allocation.
41 points by jandeboevrie 179 days ago quuxplusone.github.io 18 comments
Summary not yet generated for this article.

Comments (18 of ) ⌛

Loading more comments... ⌛
Scroll down to load more comments
No comments available.
Type to search HN and engineering blog articles
Press Escape to close  |  ↑↓ to navigate  |  Enter to open