
Brendan Miller skrev:
I've been interested in non nullable smart pointers for a while. I noticed a thread I wanted to check if anyone was still interested in doing it: http://lists.boost.org/Archives/boost/2008/04/135616.php
This seems like a worthwhile activity. Null is a legacy element from C that essentially breaks type safety.
FWIW, Boost.PtrContainer does not allow you to put nulls in containers; if you want nulls you have to ask for it: boost::ptr_vector< boost::nullable<T> > vec; I guess it would be trivial to add something like typedef boost::shared_ptr< boost::non_null<T> > ptr_type; which would not be default constructible, and which would throw if you inserted a null (rather than providing a check in operator->). Peter, is that something that has been considered? -Thorsten