29 #ifndef AURORA_ANY_HPP
30 #define AURORA_ANY_HPP
77 : mPointer(makeCopied<T>(value))
85 : mPointer(origin.mPointer)
93 : mPointer(std::move(source.mPointer))
100 template <
typename T>
103 Any(value).swap(*
this);
111 Any(origin).swap(*
this);
119 Any(std::move(source)).swap(*
this);
133 adlSwap(mPointer, other.mPointer);
141 template <
typename T>
144 assert(mType ==
typeid(T));
145 return *
static_cast<T*
>(mPointer.
get());
152 template <
typename T>
155 if (mType ==
typeid(T))
156 return static_cast<T*
>(mPointer.
get());
172 std::type_index mType;
183 #endif // AURORA_ANY_HPP
Any()
Construct empty value.
Definition: Any.hpp:67
Class template aurora::CopiedPtr.
Any(const Any &origin)
Copy constructor.
Definition: Any.hpp:84
Configuration header of the library.
Any(const T &value)
Construct from arbitrary value.
Definition: Any.hpp:76
Any & operator=(const T &value)
Assignment operator from value.
Definition: Any.hpp:101
Type aurora::SafeBool and corresponding functionality.
Helpers to declare and invoke swap() functions.
void swap(Any &other)
Swaps the Any with another Any of the same type.
Definition: Any.hpp:131
Any(Any &&source)
Move constructor.
Definition: Any.hpp:92
T * get() const
Permits access to the internal pointer. Designed for rare use.
Definition: CopiedPtr.hpp:252
T * check()
Returns a pointer to the contained value.
Definition: Any.hpp:153
Type-erased class holding any value.
Definition: Any.hpp:60
Definition: DispatchTraits.hpp:39
~Any()
Destructor.
Definition: Any.hpp:125