boostorg / boostorg/smart_ptr

intrusive_weak_ptr

Open
#81 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
111
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Hi everybody,

I have implemented a weak version of intrusive_ptr. The basic idea is that the destructor call and memory deallocation is performed independently. Destructor is called if use_count = 0 and deallocation in case of weak_count = 0.

Please find attached the first implementation of instrucive_weak_ptr and the corresponding intrusive_weak_ref_counter. The current implementation is without any modifications of the original smart_ptr source code and does not support all compilers/architectures.

I have tested the implementation on gcc 8.3 and VS 2019 with an internal compiler project with heavy usage of smart pointers within the AST.

Please let me know if the intrusive_weak_ptr implementation could be integration into the boost library. In that case, I would love to finalize it for an official integration.

Kind regards,

Timo Stripf
[intrusive_weak_ptr.zip](https://github.com/boostorg/smart_ptr/files/5014609/intrusive_weak_ptr.zip)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.