As the title says, is there a way to test the return type of the
'unaryFun' and 'binaryFun' templates from 'std.functional'?
I have the following code, and I want to to be sure that
'predicate' returns a boolean, but neither 'is(typeof(predicate)
== bool)' or 'is(ReturnType!predicate == bool)'
On Wednesday, 28 August 2019 at 13:11:46 UTC, Jabari Zakiya wrote:
When I do this:
uint a; uint b; uint[] c; uint[] d;
AliasSeq!(a, b, c, d) = genPGparameters(pg);
modpg= a;
res_0= b;
restwins = c;
resinvrs = d;
the compiler (ldc2 1.17) says:
D Projects ~/D/bin/ldc2 --release
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA, I've
got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you agree? Or is there a better way to achieve this?
On Thursday, 29 August 2019 at 09:04:17 UTC, Simen Kjærås wrote:
On Wednesday, 28 August 2019 at 13:11:46 UTC, Jabari Zakiya
wrote:
[...]
Reduced example:
unittest {
int[] a;
// cannot implicitly convert expression a of type int[] to
shared(int[])
shared int[] b = a;
}
This is
On Thursday, 29 August 2019 at 10:39:44 UTC, Jabari Zakiya wrote:
The values modpg, res_0, restwins, and resinvrs are constant
(immutable) values that are generated at run time. They are
global/shared and used inside threads.
So this process is initializing them at the start of the
program, b
On Thursday, 29 August 2019 at 08:58:18 UTC, Mek101 wrote:
As the title says, is there a way to test the return type of
the 'unaryFun' and 'binaryFun' templates from 'std.functional'?
I have the following code, and I want to to be sure that
'predicate' returns a boolean, but neither
'is(typeo
On Thursday, August 29, 2019 4:11:58 AM MDT berni via Digitalmars-d-learn
wrote:
> Iterating of some structure and removing elements thereby is
> always errorprone and should be avoided. But: In case of AA, I've
>
> got the feeling, that it might be safe:
> > foreach (k,v;ways)
> >
> > if (v.e
On Wednesday, 28 August 2019 at 20:56:25 UTC, Machine Code wrote:
I was writing a recursive function that uses template, I
thought it would generate the proper template function on the
fly to match the type in the parameter but it seems to not so
so and try to use the called function, resulting
Hey, everybody! I'm having Array Problems™. The documentation on
arrays says that you can initialize all elements of a rectangular
array with the following syntax:
double[6][3] matrix = 0; // Sets all elements to 0.
However this doesn't appear to work for static initialization:
static doubl
That's right, thank you all guys. Found my mistake; should be:
serialize!(typeof(field))(__traits(getMember, output,
fieldName));
On Thursday, 29 August 2019 at 15:10:26 UTC, rombankzero wrote:
[...]
Is this a bug, or am I missing something? It would be really
convenient to be able to statically initialize rectangular
arrays in this way. Example: I have a struct that has a member
that's a rectangular float array, but I
On Thursday, 29 August 2019 at 18:11:50 UTC, Les De Ridder wrote:
It's a known bug[1].
As a workaround you could use a `static this()`:
Or LDC, and GDC probably too.
On Thursday, 29 August 2019 at 18:59:22 UTC, kinke wrote:
On Thursday, 29 August 2019 at 18:11:50 UTC, Les De Ridder
wrote:
It's a known bug[1].
As a workaround you could use a `static this()`:
Or LDC, and GDC probably too.
Sorry, that was wrt. the linked bugzilla and not this example
here
I made the following enumerations to test the predicates.
private enum bool isUnaryPredicate(alias pred, Range) =
is(typeof(unaryFun!(pred)((ElementType!Range).init)) == bool);
private enum bool isBinaryPredicate(alias pred, Range, V) =
is(typeof(binaryFun!(pred)((ElementType!Range).init, V.ini
On Thursday, 29 August 2019 at 19:06:04 UTC, kinke wrote:
Sorry, that was wrt. the linked bugzilla and not this example
here. - What does work is `static double[6][3] matrix = [0, 0,
0]`, i.e., initializing each nested 1D array with a scalar 0.
I guess I'll use this workaround, though obviousl
15 matches
Mail list logo