its not useless in case
begin({1,2,3})

вт, 30 авг. 2022 г. в 18:43, hamburger blacktea via Std-Proposals <std-proposals@lists.isocpp.org>:
See https://stackoverflow.com/q/25215590. That's an old question (in 2014).

So I want to solve it:

Proposed resolution:


      1. Remove 17.11.5 [support.initlist.range]:

template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
-1- Returns: il.begin().
template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
-2- Returns: il.end()

      2. Modify 17.11.2 [initializer.list.syn] as indicated:

// all freestanding
namespace std {
  template<class E> class initializer_list {
  public:
    using value_type      = E;
    using reference       = const E&;
    using const_reference = const E&;
    using size_type       = size_t;

    using iterator        = const E*;
    using const_iterator  = const E*;

    constexpr initializer_list() noexcept;

    constexpr size_t size() const noexcept;     // number of elements
    constexpr const E* begin() const noexcept;  // first element
    constexpr const E* end() const noexcept;    // one past the last element
  };

  // [support.initlist.range], initializer list range access
  template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
  template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
}

I tried submitting it as a standard library issue, but the LWG chair said it needed a proposal. Can someone help?

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals