A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue3900 below:

operator new should not be constrained

namespace std {
  template<class Ref, class V, class Allocator>
  class generator<Ref, V, Allocator>::promise_type {
  public:
    […]
    void* operator new(size_t size)
      requires same_as<Allocator, void> || default_initializable<Allocator>;

    template<class Alloc, class... Args>
      requires same_as<Allocator, void> || convertible_to<const Alloc&, Allocator>
        void* operator new(size_t size, allocator_arg_t, const Alloc& alloc, const Args&...);

    template<class This, class Alloc, class... Args>
      requires same_as<Allocator, void> || convertible_to<const Alloc&, Allocator>
        void* operator new(size_t size, const This&, allocator_arg_t, const Alloc& alloc,
                           const Args&...);
    […]
   };
}
[…]
void* operator new(size_t size)
  requires same_as<Allocator, void> || default_initializable<Allocator>;

template<class Alloc, class... Args>
  requires same_as<Allocator, void> || convertible_to<const Alloc&, Allocator>
  void* operator new(size_t size, allocator_arg_t, const Alloc& alloc, const Args&...);

template<class This, class Alloc, class... Args>
  requires same_as<Allocator, void> || convertible_to<const Alloc&, Allocator>
  void* operator new(size_t size, const This&, allocator_arg_t, const Alloc& alloc,
                     const Args&...);

-17- Let A be

  1. (17.1) — Allocator, if it is not void,

  2. (17.2) — Alloc for the overloads with a template parameter Alloc, or

  3. (17.3) — allocator<void> otherwise.

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

-18- Mandates: allocator_traits<B>::pointer is a pointer type. For the overloads with a template parameter Alloc, same_as<Allocator, void> || convertible_to<const Alloc&, Allocator> is modeled. -19- Effects: Initializes an allocator b of type B with A(alloc), for the overloads with a function parameter alloc, and with A() otherwise. 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. -20- Returns: A pointer to the allocated storage.

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