弱引用或指针

时间:2016-01-17 13:16:26

标签: d

D如何管理对象的所有权?例如,我需要表达以下内容:

1.) Allocate an object
2.) Give out references/pointers
3.) If the initially allocated object is deleted, 
    all references/pointers should become inaccessible.

C++中,std::shared_ptr + std::weak_ptr可以实现这一点。这也可能在D?