
22 Jul
2008
22 Jul
'08
11:30 a.m.
Mathias Gaunard skrev:
Angel Tsankov wrote:
Is there any interest in a class template which acts like a pointer and guarantees at compile time and at no CPU or memory cost (except when a call to any of its methods is not inlined) that the pointer is not null?
Preventing empty or invalid cases is always good. For example I think it's a shame Boost.Function, Boost.Any and the Boost Smart Pointers don't do it.
As for forcing a pointer to not be empty, I suppose you're talking of making overloads of constructor and operator= for `int' and make them generate errors?
That seems like a nice idea that I will think about applying to Boost.PtrContainer. -Thorsten