On Fri, 01 Mar 2013 16:16:46 -0500, Namespace <[email protected]>
wrote:
If your data is massy: use a class. If not and you don't need
polymorphism: use a struct. Done! ... or not?
Size is not a major factor when I decide whether to use a struct or
class. I don't think the decision for class or struct should be
inextricably linked to data size.
And I believe, actually, that passing a massive struct by value if it's an
rvalue IS the most performant -- no copy needed, no referencing needed.
However, I agree we need SOMETHING to avoid writing every function at
least twice.
I'd also point out that D's notion of rvalue vs. lvalue is too limited,
and results in unnecessary restrictions. We may need a marker to tell the
compiler whether a type is an rvalue or not. I'd also like to have a way
to specify a struct member function takes it's 'this' parameter by value.
-Steve