On Monday, 18 August 2014 at 01:22:00 UTC, Ali Çehreli wrote:
The following solution relies on an alias template parameter
and a template constraint. The code covers both Nullable
variants:
import std.typecons;
auto nullable(T)(T value)
{
return Nullable!T(value);
}
unittest
{
auto x
On Sunday, 17 August 2014 at 19:05:11 UTC, Nordlöw wrote:
On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote:
It could be sufficient, but note that in Phobos there are two
different versions of Nullable, one of them doesn't require
extra memory, it uses one value as the "null" value.
On 08/17/2014 12:05 PM, "Nordlöw" wrote:
> On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote:
>> It could be sufficient, but note that in Phobos there are two
>> different versions of Nullable, one of them doesn't require extra
>> memory, it uses one value as the "null" value.
>
> Ok, t
On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote:
It could be sufficient, but note that in Phobos there are two
different versions of Nullable, one of them doesn't require
extra memory, it uses one value as the "null" value.
Ok, thanks for the reminder.
Do you have a suggestion of
Nordlöw:
I'm missing an instantiator function for std.typecons:Nullable.
Is this is intentional? If not, is this
Nullable!T nullable(T)(T a)
{
return typeof(return)(a);
}
sufficient for our needs?
It could be sufficient, but note that in Phobos there are two
different versions of Nulla
I'm missing an instantiator function for std.typecons:Nullable.
Is this is intentional? If not, is this
Nullable!T nullable(T)(T a)
{
return typeof(return)(a);
}
sufficient for our needs?