diff options
author | David Tolnay <dtolnay@gmail.com> | 2020-12-28 17:47:51 -0800 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2020-12-28 18:06:17 -0800 |
commit | 85b6bc4a39a68c5b064807e89f1933d898e0f5b6 (patch) | |
tree | e7a87a31e86e05c0841aec38e08c6abdc350f383 /src/cxx.cc | |
parent | 215e77fbec91468f294ea372f7c5524ed890de65 (diff) | |
download | cxx-85b6bc4a39a68c5b064807e89f1933d898e0f5b6.tar.gz |
Add downgrade conversion from SharedPtr to WeakPtr
Diffstat (limited to 'src/cxx.cc')
-rw-r--r-- | src/cxx.cc | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -520,6 +520,11 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *), std::weak_ptr<CXX_TYPE> *ptr) noexcept { \ new (ptr) std::weak_ptr<CXX_TYPE>(self); \ } \ + void cxxbridge1$std$weak_ptr$##RUST_TYPE##$downgrade( \ + const std::shared_ptr<CXX_TYPE> &shared, \ + std::weak_ptr<CXX_TYPE> *weak) noexcept { \ + new (weak) std::weak_ptr<CXX_TYPE>(shared); \ + } \ void cxxbridge1$std$weak_ptr$##RUST_TYPE##$drop( \ const std::weak_ptr<CXX_TYPE> *self) noexcept { \ self->~weak_ptr(); \ |