Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以std::iterator<std::random_access_iterator_tag, const char*>用作 char 数组的迭代器?查看std::iterator定义,它只有默认、复制和移动构造函数,没有T构造函数。这是否意味着我需要继承和实现自己的迭代器?
std::iterator<std::random_access_iterator_tag, const char*>
std::iterator
T
std::iterator不能帮助你。确实可以从它继承来实现自己的迭代器,但您已经可以将指向数组的指针用作随机访问迭代器。
您甚至可以使用std::beginandstd::end来获取这些迭代器。
std::begin
std::end