
On Mon, Aug 07, 2006 at 10:11:53PM -0400, David Abrahams wrote:
Sascha Krissler <boost-dev@k.datenfreihafen.de> writes:
That's what i am doing right now. The messy interface differences could be smoothed out by optional<>.
It's not optional's job to make that decision. 0 is a valid pointer value, and it's not the same thing as "no pointer value."
The difference is that in optional<foo *> NULL is a valid pointer value In struct my_discriminator { }; optional<foo *, my_discriminator> optional<foo *, my_discriminator>::null_value = NULL; // static member NULL is not a valid pointer value (useful for std::type_info *, for example, or for a -1 integer return to indicate error)
If i had to implement all the interface of OptionalPointee again that would be a lot of duplication whether changing optional would be a couple of mpl::if_. Well i will not wait for a new release of boost to solve my poblem anyway it is a suggestion to improve the genericity of the lib.
Unfortunately, it would reduce genericity. Suddenly some types have special values that can't be represented distinctly from an empty optional.
with increased genericity i mean: make optional a concept, rather than (or in addition to) a class