Refureku v2.2.0
C++17 runtime reflection library.
Pimpl.h
1
8#pragma once
9
10#include <utility> //std::move, std::forward
11
12namespace rfk
13{
18 template <typename T>
19 class Pimpl
20 {
21 private:
23 T* _implementation;
24
28 void checkedDelete();
29
30 public:
31 Pimpl(T* implementation) noexcept;
32 Pimpl(Pimpl const& other);
33 Pimpl(Pimpl&& other) noexcept;
34 ~Pimpl();
35
41 T* get() noexcept;
42
48 T const* get() const noexcept;
49
54 void uncheckedSet(T* impl) noexcept;
55
56 Pimpl& operator=(Pimpl const& other);
57 Pimpl& operator=(Pimpl&& other) noexcept;
58
64 T* operator->() noexcept;
65
71 T const* operator->() const noexcept;
72
78 T& operator*() noexcept;
79
85 T const& operator*() const noexcept;
86 };
87
88 #include "Refureku/Misc/Pimpl.inl"
89}
Definition: Pimpl.h:20
void uncheckedSet(T *impl) noexcept
Set a new implementation without checking the state of the previous one. WARNING: If a valid implemen...
T * get() noexcept
Retrieve a pointer to the underlying object.
Definition: Allocator.h:16