Date
2024-03-15.00:00:00
Message id
12252

Content

[ 2024-03-18; Jonathan provides new wording ]

During Core review in Varna, Hubert suggested creating `T[1]` for the array case.

This wording is relative to N4971.

  1. Modify [specialized.construct] as indicated:

    template<class T, class... Args>
      constexpr T* construct_at(T* location, Args&&... args);
    
    namespace ranges {
      template<class T, class... Args>
        constexpr T* construct_at(T* location, Args&&... args);
    }
    

    -1- Constraints: is_unbounded_array_v<T> is false. The expression ::new (declval<void*>()) T(declval<Args>()...) is well-formed when treated as an unevaluated operand ([expr.context]).

    -2- Effects: Equivalent to:

    if constexpr (is_array_v<T>)
      return ::new (voidify(*location)) T[1]{{std::forward<Args>(args)...}};
    else
      return ::new (voidify(*location)) T(std::forward<Args>(args)...);