MCPcopy Create free account
hub / github.com/OpenMW/openmw / ScriptsContainerWeakPtr

Class ScriptsContainerWeakPtr

components/lua/scriptscontainer.hpp:22–42  ·  view source on GitHub ↗

Immutable ScriptsContainerLifetime

Source from the content-addressed store, hash-verified

20
21 // Immutable ScriptsContainerLifetime
22 class ScriptsContainerWeakPtr
23 {
24 ScriptsContainerLifetime mWeakPtr;
25
26 public:
27 ScriptsContainerWeakPtr(const ScriptsContainerWeakPtr&) = default;
28 ScriptsContainerWeakPtr(ScriptsContainerWeakPtr&&) = default;
29
30 explicit ScriptsContainerWeakPtr(ScriptsContainerLifetime ptr)
31 : mWeakPtr(std::move(ptr))
32 {
33 }
34
35 ScriptsContainer* operator*() const noexcept
36 {
37 if (auto ptr = mWeakPtr.get())
38 return *ptr;
39 // this shouldn't happen unless you use it after a move or try to be funny by constructing from nullptr
40 return nullptr;
41 }
42 };
43
44 inline auto operator<=>(const ScriptsContainerWeakPtr& lhs, const ScriptsContainerWeakPtr& rhs)
45 {

Callers 1

getWeakPointerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected