C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Add more methods to std::initializer_list instead of overloading

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Sat, 3 Sep 2022 14:05:24 +0800
I do not believe that adding ranges eliminates the need to care about old
things. It's also impossible that no one will try il.cbegin() and get a
compile error.

After adding methods to std::initializer_list, there is no need to overload
free function templates.

On Sat, Sep 3, 2022 at 1:13 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Sat, Sep 3, 2022 at 12:51 AM blacktea hamburger via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > I think cbegin/cend/rbegin/rend/crbegin/crend/empty/data methods should
> be added to std::initializer_list since it already has begin/end methods.
> This provides consistency, e.g. both il.begin() and il.cbegin() work. This
> way it does not need to provide overloads for std::initializer_list.
>
> Can't you just use the `ranges::*` functions that do all of those
> without having to add a dozen member functions?
>
> Also, what "does not need to provide overloads for std::initializer_list."?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-09-03 06:05:51