Does D really need something like const&?

Namespace rswhite4 at googlemail.com
Fri Mar 1 14:20:00 PST 2013


Size is next polymorphism my main reason why I would use a class 
instead of a struct.
A good heuristic size (which I have heard here) was: <= 16 bytes 
-> struct, > 16 bytes -> class.
And what are your reasons for decision?

> 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.

And what a massive struct do you think?
For example, if you have something like this:

struct Massy {
public:
	int[1024] marr;
}

I would bet that it is usually better to take 'Massy' by ref, or 
to use a class, instead of a move or a copy.


More information about the Digitalmars-d mailing list