1#ifndef NE_STL_INCLUDENE_STL_ANY_H
2#define NE_STL_INCLUDENE_STL_ANY_H
4#if defined(WIN32) || defined(_WIN32)
5#pragma warning(disable : 4503)
29#define TypeIDForT(TClass) nstd::any::type_id_for_t<typename std::decay<TClass>::type>::id()
34 template <
typename _ValueType>
35 any(
const _ValueType& value)
44 template <
typename _Ty>
57 template <
typename _ValueType>
84 template <
typename _ValueType>
102 template <
typename _ValueType>
105 template <
typename _ValueType>
113 const char*
what()
const throw() {
114 return "bad_any_cast: "
115 "failed conversion any_cast";
119template <
typename _ValueType>
121 _ValueType* ret =
nullptr;
123 if (operand ==
nullptr)
133template <
typename _ValueType>
135 return any_cast<_ValueType>(
const_cast<any*
>(operand));
138template <
typename _ValueType>
140 typedef typename std::decay<_ValueType>::type nonref;
141 static_assert(!(std::is_reference<nonref>::value),
"still right reference");
142 nonref* result = any_cast<nonref>(&operand);
145template <
typename _ValueType>
147 typedef typename std::decay<_ValueType>::type nonref;
148 static_assert(!std::is_reference<nonref>::value,
"still right reference");
149 return any_cast<const nonref&>(
const_cast<any&
>(operand));
151template <
typename _ValueType>
156template <
typename _ValueType>
158 return UnsafeanyCast<_ValueType>(
const_cast<any*
>(operand));
Definition: ne_stl_any.h:85
holder & operator=(const holder &)
holder(const _ValueType &value)
Definition: ne_stl_any.h:87
_ValueType held
Definition: ne_stl_any.h:95
virtual placeholder * clone() const
Definition: ne_stl_any.h:92
Definition: ne_stl_any.h:72
virtual ~placeholder()
Definition: ne_stl_any.h:76
type_id_t type_id_index_
Definition: ne_stl_any.h:81
virtual placeholder * clone() const =0
placeholder(const type_id_t index)
Definition: ne_stl_any.h:74
Definition: ne_stl_any.h:23
static const type_id_t type_id()
Definition: ne_stl_any.h:45
friend _ValueType * UnsafeanyCast(any *)
Definition: ne_stl_any.h:152
any(const any &other)
Definition: ne_stl_any.h:38
bool empty() const
Definition: ne_stl_any.h:69
any & operator=(any rhs)
Definition: ne_stl_any.h:63
~any()
Definition: ne_stl_any.h:41
any()
Definition: ne_stl_any.h:31
any & swap(any &rhs)
Definition: ne_stl_any.h:50
friend _ValueType * any_cast(any *)
Definition: ne_stl_any.h:120
any(const _ValueType &value)
Definition: ne_stl_any.h:35
placeholder * content
Definition: ne_stl_any.h:108
any & operator=(const _ValueType &rhs)
Definition: ne_stl_any.h:58
Definition: ne_stl_any.h:111
const char * what() const
Definition: ne_stl_any.h:113
Definition: ne_stl_any.h:10
_ValueType * any_cast(any *operand)
Definition: ne_stl_any.h:120
_ValueType * UnsafeanyCast(any *operand)
Definition: ne_stl_any.h:152
#define TypeIDForT(TClass)
Definition: ne_stl_any.h:29
Definition: ne_stl_any.h:26
static type_id_t id()
Definition: ne_stl_any.h:27
Definition: ne_stl_any.h:12
type_id_t(const type_id_t &other)
Definition: ne_stl_any.h:16
const char * name
Definition: ne_stl_any.h:13
bool operator!=(const type_id_t &other) const
Definition: ne_stl_any.h:20
bool operator==(const type_id_t &other) const
Definition: ne_stl_any.h:19
bool operator<(const type_id_t &other) const
Definition: ne_stl_any.h:18
type_id_t(const char *_name)
Definition: ne_stl_any.h:14