Boost logo

Boost Users :

From: LoadCom (LoadCom_at_[hidden])
Date: 2007-11-18 19:25:24


Thank you all for the help.

I'll consider a new solution according to your suggestions.

------------------
Max
2007-11-19

-------------------------------------------------------------
·¢¼þÈË£ºMichael Linck
·¢ËÍÈÕÆÚ£º2007-11-10 07:28:32
ÊÕ¼þÈË£ºboost-users_at_[hidden]
³­ËÍ£º
Ö÷Ì⣺Re: [Boost-users] [STL] An question about list::iterator


> The question is: I want to have an iterator of a std::list type
> that denotes a NULL iterator, which means the iterator points to
> nothing, and is obviously different from list::end(), which points
> to the pass-the-end of a list.

I can only think of two possible uses for this (you didn't explicitly
mention one) and I don't think either of them should pass any code
review. The first one because it doesn't require a special iterator,
and the second one because it's *dangerous*.
The first one is to see whether and entry in a container is null. This
should not require a separate iterator (more work than necessary.) It
should merely require that the container be a container of pointers and
a check for the value of the stored pointers.
The second reason is that you're attempting to erase entries in a
container without shrinking/growing the container. In other words,
using an inappropriate container as an object pool. All I can say to
that is "don't" because this is eradicates all the benefits of using
standard containers. If you're having performance problems, think about
changing what type of container you're using instead.

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net