Option!T

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Dec 11 07:49:40 PST 2013


On 12/11/13 6:25 AM, qznc wrote:
> On Tuesday, 10 December 2013 at 18:15:58 UTC, Andrei Alexandrescu wrote:
>> On 12/10/13 9:40 AM, JR wrote:
>>> On Tuesday, 10 December 2013 at 17:28:26 UTC, Andrei Alexandrescu wrote:
>>>> We have only(x) (http://dlang.org/phobos/std_range.html#.only) to be a
>>>> collection of exactly one value, but not a type for "a value of type T
>>>> or nothing at all".
>>>
>>> Is this not what Nullable!T is?
>>
>> Nullable is not a range.
>
> Nullable!T is a type for "a value of type T or nothing at all". It also
> provides a range interface if the T value is a range.
>
> Where would you use an explicit zero or one element range?

See the URL I posted in the opening of this thread.

Andrei



More information about the Digitalmars-d mailing list