On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
auto opOpAssign(string op)(in ElementType rhs)
{
mixin("return this" ~ op ~ "rhs;");
}
```
check what `op` is. pretty sure it is "+" not "+=" so your
element isnt' saved anywhere. also a bit iffy there isn't a
member here to work
On Sunday, 17 December 2023 at 04:15:02 UTC, Ki Rill wrote:
On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
I am trying to overload `opOpAssign` for my class. The code
[...]
I forgot to mention, it is relevant to
[`Value`](https://github.com/rillki/tiny-grad/blob/main/source/rk/
On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
I am trying to overload `opOpAssign` for my class. The code
[...]
I forgot to mention, it is relevant to
[`Value`](https://github.com/rillki/tiny-grad/blob/main/source/rk/tgrad/core/value.d) class only.
I am trying to overload `opOpAssign` for my class. The code
compiles, but it does not seem to be working.
```d
// binary operations have already been implemented for Value
// i need +=, -=, *=, /=
auto opOpAssign(string op)(Value rhs)
{
mixin("return this" ~ op ~ "rhs;");
}
auto opOpAssign(
On Sunday, 17 December 2023 at 00:10:56 UTC, Kevin Bailey wrote:
instead it seems like 'm' is a pointer to a std::map, that is
initialized on use if null. (I think it's that latter part that
gives the illusion of being already initialized.)
Yes:
https://dlang.org/spec/hash-map.html#constructi
On Saturday, 16 December 2023 at 22:44:16 UTC, Dennis wrote:
That's because `m[f] = 1` initializes the associative array to
something non-null. If you pass a `null` AA to a function which
adds things, the caller will still have a null pointers. You
can initialize a non-null empty AA like this
On Saturday, 16 December 2023 at 22:44:16 UTC, Dennis wrote:
That's because `m[f] = 1` initializes the associative array to
something non-null. If you pass a `null` AA to a function which
adds things, the caller will still have a null pointers.
I've gotten this error in deployed Perl. Whenever
On Saturday, 16 December 2023 at 21:30:55 UTC, kdevel wrote:
If you comment out this line
```
//m[f] = 1;
```
in your main function of your posted code you can catch up with
your
real programm insofar as you now need a ref parameter here, too.
That's because `m[f] = 1` initializes the a
On Tuesday, 5 December 2023 at 03:36:04 UTC, Steven Schveighoffer
wrote:
Are you using -checkaction=context?
Right.
[...]
For reference:
https://issues.dlang.org/show_bug.cgi?id=22374
https://issues.dlang.org/show_bug.cgi?id=22902
https://issues.dlang.org/show_bug.cgi?id=19937
You even repo
On Saturday, 16 December 2023 at 20:04:54 UTC, Kevin Bailey wrote:
I've added a TON of writeln's to confirm this. The *instant* I
made the parameter "ref", the real program starts acting as
expected, and the print-outs show the correct results.
If you comment out this line
```
//m[f] = 1;
Perhaps someone can help solve this mystery. I have a sample
program that adds structs to an associative array (as keys) in a
subroutine. The program passes the array by reference as expected
(below).
My real program does the same thing and yet the associative array
is passed by value. Thus a
11 matches
Mail list logo