Date
2023-02-26.11:31:28
Message id
13423

Content

Currently, std::(ranges::)destroy_at is specified to destroy array elements in the increasing index order ([specialized.destroy]/1.1), which is inconsistent with the decreasing order specified in the core language ([class.dtor]/13) and the order for arrays created by std::make_shared and std::allocate_shared (mandated by LWG 3005).

This wording is relative to N4928.

  1. Modify [specialized.destroy] as indicated:

    template<class T>
      constexpr void destroy_at(T* location);
    
    namespace ranges {
      template<destructible T>
        constexpr void destroy_at(T* location) noexcept;
    }
    

    -1- Effects:

    1. (1.1) — If T is an array type, equivalent to destroy(rbeginbegin(*location), rendend(*location)).

    2. (1.2) — Otherwise, equivalent to location->~T().