constexpr typed non-dynamic uninitialized storage

Viewed 92

In C++20, we have

constexpr T* std::allocator<T>::allocate( std::size_t n );

to allocate typed dynamic uninitialized storage (and construct_at to construct objects) in compile-time.

But do we have typed non-dynamic storage in compile-time, for example, a typed aligned_storage?


Edit: One useful usage of this is to implement constexpr static_vector:

template<class T, size_t Cap>
class static_vector {
    size_t size;
    Storage<T, Cap> storage;
};
0 Answers
Related