|
Hi, I�m
beginning with stl list containers. So far I�ve always been
using the MFC collections but now I need to port an app to Linux so I thought
stl collections are a better alternative.. Anyway, I believe this should be a trivial question, in
particular, about the correct use of the stl::list collection and
iterators. Lets
say I have the following class: CMyClass {
(�)
std::list <CMyObject> m_MyList;
(�) } and
that I want to add methods to this class for adding, removing and showing
CMyObject items. In my previous implementations with MFC, I added a CMyObject
pointer data member that pointed to the current item in the
list: CMyObject * m_pCurrentObject; This
pointer is initialized to NULL in the constructor and then is assigned to every
item added to the list. My
question is: should I use now an iterator (as a data member in CMyClass) to keep
track of the current item in the list? I know that iterators are invalidated
with some operations such as erase(). Is there a better
approach? Thanks for your
advices. Carlos |
- Re: [msvc] About std::list Juan Carlos
- Re: [msvc] About std::list Paul Grenyer
- Re: [msvc] About std::list Juan Carlos
- Re: [msvc] About std::list Max
- Re: [msvc] About std::list Juan Carlos
- RE: [msvc] About std::list Ehsan Akhgari
- Re: [msvc] About std::list Paul Grenyer
- Re: [msvc] About std::list Juan Carlos
