15#ifndef A_UTIL_UTIL_MEMORY_DETAIL_STACK_PTR_DECL_HEADER_INCLUDED
16#define A_UTIL_UTIL_MEMORY_DETAIL_STACK_PTR_DECL_HEADER_INCLUDED
30 std::size_t StackSize =
sizeof(T),
31 std::size_t Alignment =
alignof(std::size_t)>
108 explicit operator bool()
const noexcept;
118 template <
typename... Args>
119 void reset(Args&&... args);
131 enum StackPtrIntrospection {
135 OverheadSize = (Alignment - (StackSize % Alignment)),
137 StorageSize = StackSize + OverheadSize,
139 FirstFlagPosition = StackSize
143 enum StackPtrFlagPositions {
144 InitializeStatus = FirstFlagPosition
148 enum class StackPtrFlags :
char {
164 const void* address()
const;
171 void setFlag(StackPtrFlagPositions position, StackPtrFlags flag);
177 bool isConstructed()
const noexcept;
188 template <
typename U, std::
size_t SSize, std::
size_t A>
193 std::array<char, StorageSize> _storage;
206template <
typename T, std::
size_t StackSize, std::
size_t Alignment>
218template <
typename T, std::
size_t StackSize, std::
size_t Alignment>
233 std::size_t StackSize =
sizeof(T),
234 std::size_t Alignment =
alignof(std::size_t),
Definition stack_ptr_decl.h:32
void reset()
Unitializes the storage and, if constructed, destructs the storaged object.
Definition stack_ptr_impl.h:111
StackPtr & operator=(StackPtr other)
Definition stack_ptr_impl.h:65
StackPtr()
Initializes the storage and constructs object ot type T by calling its default ctor.
Definition stack_ptr_impl.h:25
T * operator->()
Definition stack_ptr_impl.h:81
void swap(StackPtr &other)
Definition stack_ptr_impl.h:129
friend bool operator==(const StackPtr< U, SSize, A > &lhs, const StackPtr< U, SSize, A > &rhs)
T & operator*()
Definition stack_ptr_impl.h:93
Serves as component for memory access and management.
Definition memory.h:20
bool operator!=(const StackPtr< T, StackSize, Alignment > &lhs, const StackPtr< T, StackSize, Alignment > &rhs)
Definition stack_ptr_impl.h:223
void swap(StackPtr< T, StackSize, Alignment > &lhs, StackPtr< T, StackSize, Alignment > &rhs)
Definition stack_ptr_impl.h:191
constexpr auto makeStackPtr(Args &&... args) -> StackPtr< T, StackSize, Alignment >
Definition stack_ptr_impl.h:230
Serves as the root component, with common functionality documented in core functionality.
Definition base.h:24