由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - std::list::iterator question
相关主题
reverse LL recursively[合集] 关于C++ STL的list的一个问题
一个C++的概念问题请教 C++ std::list iterator 对 template class pointer 的应用问题
再问两个C++问题Java: use a HashSet to find the elements that are common in all lists
const_reverse_iterator和reverse_iterator有什么区别? (转载)C++11里list迭代器判空仍然知道具体的list对象吗?
请教一个MS Linked List的问题intel icc hash_map 求救!
gprof和STL的问题STL感觉实在太变态了
问一个有关C++里面list的问题。[菜鸟问题]类模板问题
如何取一个list的第i个elementc++ iterator 弱问
相关话题的讨论汇总
话题: iterator话题: std话题: list话题: back话题: question
进入Programming版参与讨论
1 (共1页)
g*********s
发帖数: 1782
1
i need to keep track of the iterators to both the head element and the
tail elements given a std::list.
using name space std;
vector::iterator > x;
x.push_back(L.begin());
x.push_back(L.end());
x.back()--;
is there any alternative to replace the last two lines?
it seems the following not working. so reverse_iterator can't be casted to
iterator in force?
x.push_back(list::iterator(L.rbegin()));
t****t
发帖数: 6806
2
how about
x.push_back(--L.end());
but why do you spend time on such things...

【在 g*********s 的大作中提到】
: i need to keep track of the iterators to both the head element and the
: tail elements given a std::list.
: using name space std;
: vector::iterator > x;
: x.push_back(L.begin());
: x.push_back(L.end());
: x.back()--;
: is there any alternative to replace the last two lines?
: it seems the following not working. so reverse_iterator can't be casted to
: iterator in force?

z****e
发帖数: 2024
3
.base()
but that's still not what you want.
difference between reverse iterator and iterator is no more close than
difference between class A; and class B;

【在 g*********s 的大作中提到】
: i need to keep track of the iterators to both the head element and the
: tail elements given a std::list.
: using name space std;
: vector::iterator > x;
: x.push_back(L.begin());
: x.push_back(L.end());
: x.back()--;
: is there any alternative to replace the last two lines?
: it seems the following not working. so reverse_iterator can't be casted to
: iterator in force?

b*******s
发帖数: 5216
4
而且保存iterator没什么意义
iterator很容易失效
1 (共1页)
进入Programming版参与讨论
相关主题
c++ iterator 弱问请教一个MS Linked List的问题
c++ template question:gprof和STL的问题
请问Linux底下有没有最简易的show 2D x-y curve的工具问一个有关C++里面list的问题。
用那个design pattern好?如何取一个list的第i个element
reverse LL recursively[合集] 关于C++ STL的list的一个问题
一个C++的概念问题请教 C++ std::list iterator 对 template class pointer 的应用问题
再问两个C++问题Java: use a HashSet to find the elements that are common in all lists
const_reverse_iterator和reverse_iterator有什么区别? (转载)C++11里list迭代器判空仍然知道具体的list对象吗?
相关话题的讨论汇总
话题: iterator话题: std话题: list话题: back话题: question