On Monday, 4 May 2015 at 01:58:12 UTC, bitwise wrote:
If I have a large struct that needs to be passed around, like a 4x4 matrix for example, how do I do that efficiently in D?

In std.datetime, "in" is used for most struct parameters, but I'm confused by the docs for function parameter storage classes[1].

In C++, I would pass a large struct as (const&):
void foo(const Matrix4x4 &m);

Is "in" in D the same as passing by const& in C++? The documentation doesn't say anything about "in" being a reference, but it doesn't say that "out" parameters are references either, even though it's usage in the example clearly shows that it is.

Thanks,
  Bit

http://dlang.org/function.html#parameters

Use the ref storage class. You can use more than one storage class i.e,

foo(in ref int x)

Unless I misunderstood you.

Reply via email to