John Carmack applauds D's pure attribute

Simon s.d.hammett at
Sun Feb 26 07:04:51 PST 2012

On 26/02/2012 03:22, Walter Bright wrote:
> On 2/25/2012 4:01 PM, Simon wrote:
>> On 25/02/2012 22:55, Walter Bright wrote:
>>> Enter C++'s shared_ptr. But that works by, for each object, allocating a
>>> *second* chunk of memory to hold the reference count. Right off the bat,
>>> you've got twice as many allocations & frees with shared_ptr than a GC
>>> would have.
>> so you don't have to have twice as many allocations.
> There are many ways to do shared pointers, including one where the
> reference count is part of the object being allocated. But the C++11
> standard share_ptr does an extra allocation.

The stl one is based on boost, so it has make_shared as well:

and it's in vs 2010

Not that I'm claiming shared pointers are superior to GC.

My enormous talent is exceeded only by my outrageous laziness.

More information about the Digitalmars-d mailing list