opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
shared_lifetime_block.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <memory>
6
7namespace osc
8{
9 // a managed lifetime that may have multiple owners and non-owning watchers
11 public:
12 LifetimeWatcher watch() const { return LifetimeWatcher{ptr_}; }
13 size_t num_owners() const { return static_cast<size_t>(ptr_.use_count()); }
14 private:
15 std::shared_ptr<int> ptr_ = std::make_shared<int>();
16 };
17}
Definition lifetime_watcher.h:11
Definition shared_lifetime_block.h:10
size_t num_owners() const
Definition shared_lifetime_block.h:13
LifetimeWatcher watch() const
Definition shared_lifetime_block.h:12
Definition custom_decoration_generator.h:5
constexpr U to(T &&value)
Definition conversion.h:56