On Friday, 19 November 2021 at 14:22:07 UTC, Paul Backus wrote:
When you pass a struct instance to a function by value, or
return a struct instance from a function by value, a copy is
made, and the copy constructor is called.
Your `opAssign` takes `rhs` by value, and returns a `str` by
[...
On Friday, 19 November 2021 at 14:05:40 UTC, rempas wrote:
So, when I assign the value of the variable "name" in the
"other_name", first it will call the copy constructor, then it
will call the assignment constructor and then it will call the
copy constructor again. Why is this happening? I was
Hi! I'm trying to make my own string type for my library. Anyway,
I'm not very experienced with structs/classes so I don't
understand what's going one here. I will not post the full code
because I don't think that anyone would like it so I will just
post the important parts that play a role (th