52 template <
typename... Types>
67 friend const T*
any_cast(
const any* operand)
noexcept;
81 any{ static_cast<const
any&>(aOther) }
85 any{ static_cast<
any&>(aOther) }
89 std::
any{ aOther.as_std_any() },
95 std::
any{
std::move(aOther.as_std_any()) },
99 aOther.cptr =
nullptr;
100 aOther.ptr =
nullptr;
102 template <
typename ValueType>
104 std::
any{
std::decay_t<ValueType>{aValue} },
105 cptr{ &any::do_cptr<std::decay_t<ValueType>> },
106 ptr{ &any::do_ptr<std::decay_t<ValueType>> }
109 template <
typename ValueType>
111 std::
any{
std::decay_t<decltype(aVariant)>{aVariant} },
112 cptr{ &any::do_cptr<std::decay_t<
decltype(aVariant)>> },
113 ptr{ &any::do_ptr<std::decay_t<
decltype(aVariant)>> }
120 return *
this =
static_cast<const any&
>(aRhs);
125 return *
this =
static_cast<any&
>(aRhs);
129 std::any::operator=(aRhs.as_std_any());
136 std::any::operator=(std::move(aRhs.as_std_any()));
143 template<
typename ValueType>
146 std::any::operator=(std::decay_t<ValueType>{aRhs});
147 cptr = &any::do_cptr<std::decay_t<ValueType>>;
148 ptr = &any::do_ptr<std::decay_t<ValueType>>;
152 template<
class ValueType,
class... Args>
153 std::decay_t<ValueType>&
emplace(Args&&... args)
155 auto& result = std::any::emplace<ValueType>(std::forward<Args...>(args...));
156 cptr = &any::do_cptr<std::decay_t<ValueType>>;
157 ptr = &any::do_ptr<std::decay_t<ValueType>>;
160 template<
class ValueType,
class U,
class... Args>
161 std::decay_t<ValueType>&
emplace(std::initializer_list<U> il, Args&&... args)
163 auto& result = std::any::emplace<ValueType>(il, std::forward<Args...>(args...));
164 cptr = &any::do_cptr<std::decay_t<ValueType>>;
165 ptr = &any::do_ptr<std::decay_t<ValueType>>;
176 std::any::swap(aOther.as_std_any());
183 return std::any::has_value();
185 std::type_info
const&
type()
const override
187 return std::any::type();
192 return *
this ==
static_cast<const any&
>(aOther);
196 return *
this !=
static_cast<const any&
>(aOther);
200 return *this < static_cast<const any&>(aOther);
204 if (cptr !=
nullptr && aOther.cptr !=
nullptr)
205 return cptr(*
this) == aOther.cptr(aOther);
207 return cptr == aOther.cptr;
211 if (cptr !=
nullptr && aOther.cptr !=
nullptr)
212 return cptr(*
this) != aOther.cptr(aOther);
214 return cptr != aOther.cptr;
218 if (cptr !=
nullptr && aOther.cptr !=
nullptr)
219 return cptr(*
this) < aOther.cptr(aOther);
221 return cptr < aOther.cptr;
224 const std::any& as_std_any()
const override
228 std::any& as_std_any()
override
232 const void* unsafe_ptr()
const override
239 void* unsafe_ptr()
override
246 template <
typename T>
247 static const void* do_cptr(
const any& aArg)
249 return &std::any_cast<const T&>(aArg.as_std_any());
251 template <
typename T>
252 static void* do_ptr(any& aArg)
254 return &std::any_cast<T&>(aArg.as_std_any());
257 const void*(*cptr)(
const any&);
269 return std::any_cast<T>(operand.as_std_any());
274 return std::any_cast<T>(operand.as_std_any());
279 return std::any_cast<T>(std::move(operand.as_std_any()));
284 return std::any_cast<const T*>(&operand->as_std_any());
289 return std::any_cast<T*>(&operand->as_std_any());
294 return *
static_cast<const std::decay_t<T>*
>(operand.unsafe_ptr());
299 return *
static_cast<std::decay_t<T>*
>(operand.unsafe_ptr());
std::decay_t< ValueType > & emplace(std::initializer_list< U > il, Args &&... args)
bool operator==(const i_any &aOther) const override
any & operator=(any &&aRhs)
friend T unsafe_any_cast(const any &operand) noexcept
bool operator!=(const i_any &aOther) const override
any & operator=(ValueType &&aRhs)
any & operator=(i_any &&aRhs)
any(ValueType &&aValue, std::enable_if_t<!is_variant_v< std::decay_t< ValueType > >, sfinae >={})
friend T any_cast(const any &operand)
bool operator==(const any &aOther) const
std::type_info const & type() const override
any(ValueType &&aVariant, std::enable_if_t< is_variant_v< std::decay_t< ValueType > >, sfinae >={})
any & operator=(const any &aRhs)
bool operator<(const i_any &aOther) const override
bool operator<(const any &aOther) const
any & operator=(const i_any &aRhs)
std::decay_t< ValueType > & emplace(Args &&... args)
bool operator!=(const any &aOther) const
bool has_value() const override
constexpr bool is_variant_v
T unsafe_any_cast(const any &operand) noexcept
T any_cast(const any &operand)
void swap(plf::hive< element_type, allocator_type > &a, plf::hive< element_type, allocator_type > &b) noexcept(std::allocator_traits< allocator_type >::propagate_on_container_swap::value||std::allocator_traits< allocator_type >::is_always_equal::value)
static constexpr bool value