15#include <AUI/Traits/types.h>
30 template<
typename T, std::
size_t storageSize, std::
size_t storageAlignment = 8>
33 template<
typename... Args>
35 new (
ptr()) T(std::forward<Args>(
args)...);
36 static_assert(storageSize >=
sizeof(T),
"not enough size");
37 static_assert(storageAlignment %
alignof(T) == 0,
"alignment does not match");
41 new (
ptr()) T(other.value());
45 new (
ptr()) T(std::move(other.value()));
49 new (
ptr()) T(other.value());
54 new (
ptr()) T(std::move(other.value()));
59 new (
ptr()) T(std::move(other));
70 return reinterpret_cast<T&
>(mStorage);
74 const T& value()
const noexcept {
75 return reinterpret_cast<const T&
>(mStorage);
80 return &
reinterpret_cast<T&
>(mStorage);
84 const T*
ptr()
const noexcept {
85 return &
reinterpret_cast<const T&
>(mStorage);
89 T* operator->()
noexcept {
90 return &
reinterpret_cast<T&
>(mStorage);
94 const T* operator->()
const noexcept {
95 return &
reinterpret_cast<const T&
>(mStorage);
99 T& operator*()
noexcept {
100 return reinterpret_cast<T&
>(mStorage);
104 const T& operator*()
const noexcept {
105 return reinterpret_cast<const T&
>(mStorage);
110 std::aligned_storage_t<storageSize, storageAlignment> mStorage;
API_AUI_CORE const ACommandLineArgs & args() noexcept
Definition: OSAndroid.cpp:29
Utility wrapper implementing the stack-allocated (fast) pimpl idiom.
Definition: APimpl.h:31
Definition: SharedPtrTypes.h:114