Why allocate_at_least() in C++23?

  allocator, c++, c++23, performance, standards

According to cppref:

std::allocator<T>::allocate_at_least

Allocates count * sizeof(T) bytes of uninitialized storage, where
count is an unspecified integer value not less than n, by calling
::operator new (an additional std::align_val_t argument might be
provided), but it is unspecified when and how this function is called.

Then, this function creates an array of type T[count] in the storage
and starts its lifetime, but does not start lifetime of any of its
elements.

However, I think the already existing std::allocator<T>::allocate can do the same thing.

Why do we need std::allocator<T>::allocate_at_least in C++23?

Source: Windows Questions C++

LEAVE A COMMENT