automem v0.0.7 - C++ style smart pointers using std.experimental.allocator

Martin Nowak via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Apr 9 02:36:53 PDT 2017


On Sunday, 9 April 2017 at 08:56:52 UTC, Atila Neves wrote:
> I benchmarked RefCounted against C++'s std::shared_ptr 
> comparing ldc to clang using both shared and non-shared 
> payloads in D. std::shared_ptr is faster (I've never written a 
> smart pointer before), but the advantage of non-atomic 
> operations makes my D implementation just a bit faster when 
> non-shared. I think with some work it can be significantly 
> faster without any loss of thread safety.

Nice!
You know you can overload `this(this) shared` do you? My plan was 
to use that for atomic RC, so that ppl. can use 
`shared(RefCounted)` when necessary.



More information about the Digitalmars-d-announce mailing list