Date: Fri, 06 Sep 2019 17:05:00 +0000
Eduard Antonyan via Std-Discussion:
> Every single time I've used the InputIterator constructors of various
> containers (e.g. vector or set), it's been to convert an existing container
> from one type to another (e.g. set to a vector). As such my code could've
> been simpler and more concise if the constructors simply took a container
> as an argument and did the begin/end internally.
>
> Any reasons to not have such constructors? These are trivial to write and
> I'm happy to provide the code, but perhaps I'm missing something.
>
> Thanks.
>
>
Yes, every function that takes a pair of iterators should have an
overload that takes std::ranges::input_range (or similar). This should
be easy to add in C++23.
> Every single time I've used the InputIterator constructors of various
> containers (e.g. vector or set), it's been to convert an existing container
> from one type to another (e.g. set to a vector). As such my code could've
> been simpler and more concise if the constructors simply took a container
> as an argument and did the begin/end internally.
>
> Any reasons to not have such constructors? These are trivial to write and
> I'm happy to provide the code, but perhaps I'm missing something.
>
> Thanks.
>
>
Yes, every function that takes a pair of iterators should have an
overload that takes std::ranges::input_range (or similar). This should
be easy to add in C++23.
Received on 2019-09-06 12:08:19