On Wednesday, 9 December 2015 at 13:13:36 UTC, BBaz wrote:
1) remove works with an index
I guess I did read it wrong. Sorry.
Is there a convenience function that allows me to remove an/all
object(s) with a certain value from an array or do I need to
write one myself?
2) remove does not rem
Hi!
I'm trying to remove an item from an array of objects. But I get
error messages when compiling (see below) which I do not
understand. I figured I had to override opEquals for it to work,
but no.
How do I get this to work?
Regards
class A
{
this(string si, uint ui) { s
On Sunday, 6 December 2015 at 12:27:49 UTC, cym13 wrote:
A static array is a value type so it is passed by value to
functions.
Oh, right, I totally forgot about that. Thank you for reminding
me.
And yes, I was not planning on doing that. I just have a local
fixed-size array that I wanted to g
Hi! I have the following code:
int main(string[] argv)
{
import std.algorithm: sum;
import std.stdio: writeln;
uint[3] a1 = [1, 2, 3];
uint[] a2;
for (int i = 1; i <= 3; ++i)
a2 ~= i;
writeln("a1: ", sum(a1));
writeln("
Hi!
I am wondering if there is any way to define constants to pass to
the compiler like in C (especially useful in combination with
Makefiles, for obvious reasons), i.e.:
gcc -DPREFIX=\"/usr/local\" -o myprogram main.c
Like this a program can look for certain files inside its prefix
dur
On Saturday, 6 June 2015 at 10:20:34 UTC, Marc Schütz wrote:
Because `SList` is a struct, which is a value type that is
allocated where you declare it (here on the stack), while you
used a class, which is a reference type and has to be allocated
with `new`.
You can also turn your `Stack` typ
On Saturday, 6 June 2015 at 10:10:15 UTC, Manfred Nowak wrote:
x is not initialized.
`auto x= new Stack!(int);'
will do.
Thank you two.
But that leads me to another question: Why do I need to
initialize x with a "new Stack" but I don't need to initialize p
with a "new SList"?
Best regards,
Hello!
I just started learning D and I come from a mostly C and C#
background.
Hello World was working, so I figured that I should try something
more complex: a template class and si I went with a simple stack.
Using dmd the code I wrote causes a segmentation fault and I am
not sure why.
i