On Monday, 7 September 2015 at 14:54:04 UTC, Jacob Carlborg wrote:
On 2015-09-07 16:44, Bahman Movaqar wrote:Does this mean that in the following piece of code, what is passed to`add` is actually a copy of `rec1`? auto rec1 = SalesRecord("p10", 1.0, 10); coll.add(rec1);Yes. structs have value semantics. If you want reference semantics you might want to use a class instead.
Actually I like the value semantics very much. I think I'm going to stick to `structs` for as much as possible :-)