A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../coroutine/generator/promise_type/operator_new.html below:

std::generator<Ref,V,Allocator>::promise_type::operator new - cppreference.com

(1) (since C++23) (2) (since C++23) (3) (since C++23)

Allocates size bytes of uninitialized storage using default or user-provided allocator.

Let A be

Let B be std::allocator_traits<A>::template rebind_alloc<U> where U is an unspecified type whose size and alignment are both __STDCPP_DEFAULT_NEW_ALIGNMENT__.

Initializes an allocator b of type B with:

1) A(),

2,3) A(alloc).

Uses b to allocate storage for the smallest array of U sufficient to provide storage for a coroutine state of size size, and unspecified additional state necessary to ensure that operator delete can later deallocate this memory block with an allocator equal to b.

The program is ill-formed unless std::allocator_traits<B>::pointer is a pointer type and for overloads (2,3), std::same_as<Allocator, void> || std::convertible_to<const Alloc&, Allocator> is modeled.

[edit] Parameters size - the size of the storage to allocate alloc - a user provided allocator of type Alloc [edit] Return value

A pointer to the allocated storage.

[edit] Exceptions

1-3) May throw.

[edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 3900 C++23 overloads (2,3) were constrained on conversion of Alloc to Allocator mandated

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4