
24 Feb
2006
24 Feb
'06
9:31 a.m.
What about a null_helper class? This is my approach: namespace boost { static class null_helper { public: template <typename T> inline operator shared_ptr<T>() const { return shared_ptr<T>(); } template <typename T> inline operator T *() const { return 0; } }null; } I find this very useful in samples like this: class node { public: node(boost::shared_ptr<node> parent = boost::null, // instead of boost::shared_ptr<node>() int *value = boost::null); // no difference from ordinary pointers }; Waiting for your feedback ;) ------------- Raffaele Romito
7051
Age (days ago)
7051
Last active (days ago)
0 comments
1 participants
participants (1)
-
Raffaele Romito