Bug 14432 – move construction for RefCounted

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-10T02:36:00Z
Last change time
2017-07-19T17:43:03Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2015-04-10T02:36:56Z
It's currently not possible to use non-copyable structs that model unique ownership of a resource with RefCounted to share ownership. This should work similar to how a unique_ptr in C++ can be converted to a shared_ptr, and makes unique ownership a viable default for resources such as files.
Comment #1 by github-bugzilla — 2015-04-20T13:44:24Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/a6a6870beb69537f2ccd3d50289594ebae30ad15 fix Issue 14432 - move construction for RefCounted - add RefCounted!T.this(T) which takes an RValue or a copy and use move to initialized the refcounted store - add refCounted to infer T from the argument and disable RefCounted's autoInit, also move initializes the store https://github.com/D-Programming-Language/phobos/commit/f7498ad8ec147114b1bcbc61d0e4db3e033417f5 Merge pull request #3171 from MartinNowak/refCounted fix Issue 14432 - move construction for RefCounted
Comment #2 by github-bugzilla — 2017-07-19T17:43:03Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a6a6870beb69537f2ccd3d50289594ebae30ad15 fix Issue 14432 - move construction for RefCounted https://github.com/dlang/phobos/commit/f7498ad8ec147114b1bcbc61d0e4db3e033417f5 Merge pull request #3171 from MartinNowak/refCounted