On 27/08/2018 12:51 PM, SG wrote:
On Sunday, 26 August 2018 at 16:39:53 UTC, rikki cattermole wrote:
UFCS function called isNull.
e.g.
import std.traits : isPointer;
bool isNull(T)(T value) if (is(T == class) || isPointer!T) {
return value is null;
}
Hi Rikki,
I'm still confused, I
On Sunday, 26 August 2018 at 16:39:53 UTC, rikki cattermole wrote:
UFCS function called isNull.
e.g.
import std.traits : isPointer;
bool isNull(T)(T value) if (is(T == class) || isPointer!T) {
return value is null;
}
Hi Rikki,
I'm still confused, I want to create a extension for
On Sunday, August 26, 2018 5:10:29 PM MDT Nicholas Wilson via Digitalmars-d-
learn wrote:
> On Sunday, 26 August 2018 at 20:17:30 UTC, aliak wrote:
> > So if we had this:
> >
> > struct A(T) {
> >
> > auto proxy() @trusted {
> >
> > return B!T();
> >
> > }
> >
> > }
> >
> > struct B(T) {
>
On Sunday, 26 August 2018 at 20:17:30 UTC, aliak wrote:
So if we had this:
struct A(T) {
auto proxy() @trusted {
return B!T();
}
}
struct B(T) {
private A!T* source;
private this(A!T* s) { source = s; }
@disable this();
@disable this(this) {}
@disable void opAssign(B!T);
}
So if we had this:
struct A(T) {
auto proxy() @trusted {
return B!T();
}
}
struct B(T) {
private A!T* source;
private this(A!T* s) { source = s; }
@disable this();
@disable this(this) {}
@disable void opAssign(B!T);
}
In order for f to be "safe" I need to ensure that B!T()
On Sunday, 26 August 2018 at 06:08:39 UTC, vit wrote:
const x = iota(0, 10)
.map!((x, i) => x*i)(a) ///map!((x) => x*a)
.map!((x, i) => x*i)(b) ///map!((x) => x*b)
.filter!((x, i) => x%i)(c)///filter!((x) => x%c)
.any!(x => x % c);
I think it's easier to
Hi again,
The code below works for some cases but not for the Nullable!Type.
A way to fix it should be check the type and use ".isNull" for
Nullabe!Type. But is there a simple way to test if value is null
for every case?
import std.stdio, std.typecons, std.variant, std.conv;
bool foo(T)(T
On 27/08/2018 4:37 AM, SG wrote:
Hi again,
The code below works for some cases but not for the Nullable!Type.
A way to fix it should be check the type and use ".isNull" for
Nullabe!Type. But is there a simple way to test if value is null for
every case?
import std.stdio, std.typecons,
On Friday, 24 August 2018 at 22:51:40 UTC, Paul Backus wrote:
On Friday, 24 August 2018 at 15:18:13 UTC, Peter Alexander
wrote:
I can write scaleAll like this:
auto scaleAll(int[] xs, int m) @nogc {
return repeat(m).zip(xs).map!(mx => mx[0] * mx[1]);
}
So that repeat(m) stores m, but it is
On Friday, 24 August 2018 at 15:18:13 UTC, Peter Alexander wrote:
Consider this code, which is used as an example only:
auto scaleAll(int[] xs, int m) {
return xs.map!(x => m * x);
}
As m is captured, the delegate for map will rightly allocate
the closure in the GC heap.
In C++, you would
10 matches
Mail list logo