Boost logo

Boost :

Subject: Re: [boost] [optional] std::tr2::optional
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2011-11-21 10:54:13


> > Also, if someone likes the assignment-of-"none" syntax, in C++11 there
will
> > be a similar syntax available:

> > std::tr2::optional<T> op = {};
> > op = {};

> Wouldn't that be confusing with creating a filled optional with the value
> constructed with empty initialization list? If there is
assignment-of-none
> syntax, it should probably be more explicit, pretty much like the current
> "none" keyword.

I see your point. But note that this confusing syntax will still be
available (and is available today on compilers that support the new
initialization syntax) even if we have "none" keyword. This is just the new
way of requesting value-initialization (default constructor).

Personally, I have doubts about introducing entity "none". There would be
too many ways of indicating the null-state for different types. You could
look at nullptr as a special pointer with special value; but you could also
think of it as a keyword for indicating null-state: a stet of not having
any meaningful value. Pointers represent addresses: they can either
represent a valid address or not-an-address. Now for optionals we will have
none for not-a-value, even though it is almost the same concept.

I was thinking also about null_value or nullval. But they appear even more
confusing than an already familiar "none".

I am not English speaker, so I cannot be positive about it, but does "none"
fit logically into the context? Is "nothing" or "naught" more suitable,
gramatically?

Regards,
&rzej


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk