struct vs class benchmark (was Re: Give struct the status it

David Medlock noone at nowhere.com
Tue Mar 28 04:29:21 PST 2006


Ben Phillips wrote:
> Basically what your benchmark (along with Hong's) prove is that classes and
> structs each have different uses (duh!). Use structs in situations like Hong's
> case where classes would require a ton of allocation, and use classes in
> situations like your case where passing by value would induce enormous overhead
> costs.
> 

Or if you still want to use classes, you can use an object pool.

Since object pools are a nice paradigm in some instances, I wonder if a 
good standard set of library primitives could be built into phobos?

-DavidM





More information about the Digitalmars-d mailing list