C++ Logo


Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 3 Sep 2022 11:02:45 -0400
On Sat, Sep 3, 2022 at 9:26 AM blacktea hamburger via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> How do you explain associative/unordered associative containers? Both their iterator/const_iterator member types are constant iterators, but they still provide cbegin/cend methods.

For the various `set`s, they are constant iterators. But this is not
true for `map`s: the key of the pair is const, but not the value.

> And how do you explain rbegin/rend/empty, etc?

What about them? The whole point of `ranges::rbegin/rend` is that
people who write some range type don't have to provide those members
at all if the defaults of `ranges::rbeing/rend` work. And they do work
for `initializer_list`.

Received on 2022-09-03 15:03:21