Difference between revisions of "Talk:cpp/iterator/iterator"
From cppreference.com
< Talk:cpp
(Why deprecated?) |
(re) |
||
Line 2: | Line 2: | ||
What's the recommended alternative? | What's the recommended alternative? | ||
[[Special:Contributions/194.74.130.171|194.74.130.171]] 00:25, 20 May 2021 (PDT) | [[Special:Contributions/194.74.130.171|194.74.130.171]] 00:25, 20 May 2021 (PDT) | ||
+ | : {{lc|std::iterator}} is just a class template that declares the template type arguments you give it as type aliases. Basically it's completely useless, as it serves to simply to obscure the purpose of those types when they could simply be provided explicitly by the custom iterator class instead (which is the alternative). Furthermore, from an object oriented perspective, I think it's non-sensical to use inheritance here; I don't think there's any use case for wanting to take a e.g. {{lc|std::iterator<std::input_iterator_tag, long, long, const long*, long>}} as say a function parameter. --[[User:Ybab321|Ybab321]] ([[User talk:Ybab321|talk]]) 04:48, 20 May 2021 (PDT) |
Revision as of 03:48, 20 May 2021
Why is it deprecated? What's the recommended alternative? 194.74.130.171 00:25, 20 May 2021 (PDT)
- std::iterator is just a class template that declares the template type arguments you give it as type aliases. Basically it's completely useless, as it serves to simply to obscure the purpose of those types when they could simply be provided explicitly by the custom iterator class instead (which is the alternative). Furthermore, from an object oriented perspective, I think it's non-sensical to use inheritance here; I don't think there's any use case for wanting to take a e.g. std::iterator<std::input_iterator_tag, long, long, const long*, long> as say a function parameter. --Ybab321 (talk) 04:48, 20 May 2021 (PDT)