Date: Sun, 26 Sep 2021 14:14:02 +0100
On Sun, 26 Sep 2021, 12:27 Vladimir Grigoriev via Std-Discussion, <
std-discussion_at_[hidden]> wrote:
> I have run the program below using gcc 8.3 and its output is true.
>
> #include <iostream>
> #include <array>
> #include <type_traits>
>
> int main()
> {
> std::cout << std::is_same<std::array<int, 2>::iterator,
> std::array<int, 5>::iterator>::value
> << '\n';
>
> return 0;
> }
>
> Though if I am not mistaken there is nothing said in the Standard whether
> iterators of two instantiations of the class template
> std::array std::array<T, N1> and std::array <T, N2> have the same types of
> iterators.
>
> It would be useful if there was adopted in the Standard that iterators of
> two instantiations std::array<T, N1> and std::array<T, N2> had the same
> types of iterators.. In this case we could use lists of iterators for
> instantiations of std::array that have the same type of the first template
> parameter.
>
>
If you wish to erase the extent of the array, you can use a dynamic span
iterator.
>
std-discussion_at_[hidden]> wrote:
> I have run the program below using gcc 8.3 and its output is true.
>
> #include <iostream>
> #include <array>
> #include <type_traits>
>
> int main()
> {
> std::cout << std::is_same<std::array<int, 2>::iterator,
> std::array<int, 5>::iterator>::value
> << '\n';
>
> return 0;
> }
>
> Though if I am not mistaken there is nothing said in the Standard whether
> iterators of two instantiations of the class template
> std::array std::array<T, N1> and std::array <T, N2> have the same types of
> iterators.
>
> It would be useful if there was adopted in the Standard that iterators of
> two instantiations std::array<T, N1> and std::array<T, N2> had the same
> types of iterators.. In this case we could use lists of iterators for
> instantiations of std::array that have the same type of the first template
> parameter.
>
>
If you wish to erase the extent of the array, you can use a dynamic span
iterator.
>
Received on 2021-09-26 08:14:18