From: SF M. E. <el...@us...> - 2004-03-02 16:54:49
|
> (1) Sometimes you need a special value to mark "error", "not supplied", > "the end" etc., so it is convenient to use null pointer for this > purpose. Please look at a design or an implementation of the standard template library. Example: I think that the iterators do not need pointers in their public interfaces to mark special positions. - http://boost.org/libs/iterator/doc/index.html - http://dtemplatelib.sourceforge.net/index.htm - http://www.melikyan.com/ptypes/ > (2) References have different assignment semantics than pointers. > Changing pointer class data members into references will most likely > change the assignment semantics of the class. Which copy semantics do you use at the moment? > (3) As I already mentioned, references can potentially confuse > garbage collector. How do Java references fit into this picture? Can "smart pointers" help? http://boost.org/libs/smart_ptr/smart_ptr.htm |