std.container.RedBlackTree versus C++ std::set

Namespace rswhite4 at googlemail.com
Thu Feb 14 02:23:17 PST 2013


> I agree. There are cases where structs make a lot of sense, 
> usually when they are very simple simple and contain no 
> pointers or references, otherwise structs should be avoided in 
> favor of classes to avoid doing copy/move constructors and to 
> avoid concerns over performance optimizations. With classes, 
> only certain points in your code require that a duplicate copy 
> be made of the class instance, the majority of code need only 
> to pass around a reference which is the default behavior - easy 
> and fast!
>
> --rt

It sounds like Java philosophy: Objects are always better.
Or have I misunderstood?
In any case, a intensive use of classes / objects, instead of 
structs would be also an enormous heap effort.
I usually try to use as few classes as possible.


More information about the Digitalmars-d-learn mailing list