1#ifndef NE_STL_INCLUDENE_STL_ANY_H
2#define NE_STL_INCLUDENE_STL_ANY_H
3#pragma warning(disable : 4503)
26#define TypeIDForT(TClass) nstd::any::type_id_for_t<typename std::decay<TClass>::type>::id()
31 template <
typename _ValueType>
32 any(
const _ValueType& value)
41 template <
typename _Ty>
54 template <
typename _ValueType>
81 template <
typename _ValueType>
99 template <
typename _ValueType>
102 template <
typename _ValueType>
110 const char*
what()
const throw() {
111 return "bad_any_cast: "
112 "failed conversion any_cast";
116template <
typename _ValueType>
118 _ValueType* ret =
nullptr;
120 if (operand ==
nullptr)
130template <
typename _ValueType>
132 return any_cast<_ValueType>(
const_cast<any*
>(operand));
135template <
typename _ValueType>
137 typedef typename std::decay<_ValueType>::type nonref;
138 static_assert(!(std::is_reference<nonref>::value),
"still right reference");
139 nonref* result = any_cast<nonref>(&operand);
142template <
typename _ValueType>
144 typedef typename std::decay<_ValueType>::type nonref;
145 static_assert(!std::is_reference<nonref>::value,
"still right reference");
146 return any_cast<const nonref&>(
const_cast<any&
>(operand));
148template <
typename _ValueType>
153template <
typename _ValueType>
155 return UnsafeanyCast<_ValueType>(
const_cast<any*
>(operand));
Definition ne_stl_any.h:82
holder & operator=(const holder &)
holder(const _ValueType &value)
Definition ne_stl_any.h:84
_ValueType held
Definition ne_stl_any.h:92
virtual placeholder * clone() const
Definition ne_stl_any.h:89
Definition ne_stl_any.h:69
virtual ~placeholder()
Definition ne_stl_any.h:73
type_id_t type_id_index_
Definition ne_stl_any.h:78
virtual placeholder * clone() const =0
placeholder(const type_id_t index)
Definition ne_stl_any.h:71
Definition ne_stl_any.h:20
static const type_id_t type_id()
Definition ne_stl_any.h:42
friend _ValueType * UnsafeanyCast(any *)
Definition ne_stl_any.h:149
any(const any &other)
Definition ne_stl_any.h:35
bool empty() const
Definition ne_stl_any.h:66
any & operator=(any rhs)
Definition ne_stl_any.h:60
~any()
Definition ne_stl_any.h:38
any()
Definition ne_stl_any.h:28
any & swap(any &rhs)
Definition ne_stl_any.h:47
friend _ValueType * any_cast(any *)
Definition ne_stl_any.h:117
any(const _ValueType &value)
Definition ne_stl_any.h:32
placeholder * content
Definition ne_stl_any.h:105
any & operator=(const _ValueType &rhs)
Definition ne_stl_any.h:55
Definition ne_stl_any.h:108
const char * what() const
Definition ne_stl_any.h:110
Definition ne_stl_any.h:7
_ValueType * any_cast(any *operand)
Definition ne_stl_any.h:117
_ValueType * UnsafeanyCast(any *operand)
Definition ne_stl_any.h:149
#define TypeIDForT(TClass)
Definition ne_stl_any.h:26
Definition ne_stl_any.h:23
static type_id_t id()
Definition ne_stl_any.h:24
Definition ne_stl_any.h:9
type_id_t(const type_id_t &other)
Definition ne_stl_any.h:13
const char * name
Definition ne_stl_any.h:10
bool operator!=(const type_id_t &other) const
Definition ne_stl_any.h:17
bool operator==(const type_id_t &other) const
Definition ne_stl_any.h:16
bool operator<(const type_id_t &other) const
Definition ne_stl_any.h:15
type_id_t(const char *_name)
Definition ne_stl_any.h:11