4 #if __cplusplus>=201103L
12 #include <epicsAssert.h>
14 #include <pv/templateMeta.h>
15 #include <pv/typeCast.h>
16 #include <pv/pvIntrospect.h>
18 namespace epics{
namespace pvData{
30 #if __cplusplus>=201103L
32 constexpr
size_t cmax(
size_t A,
size_t B) {
54 #if __cplusplus>=201103L
57 virtual const char* what()
const noexcept
61 virtual const char* what()
const throw()
63 {
return "bad_cast() type mis-match"; }
70 #if __cplusplus>=201103L
87 typedef double _largest_blob;
91 return *
reinterpret_cast<T*
>(_wrap.blob);
94 inline const T& _as()
const {
95 return *
reinterpret_cast<const T*
>(_wrap.blob);
106 typedef typename meta::strip_const<T>::type T2;
107 typedef typename detail::any_storage_type<T2>::type TT;
109 STATIC_ASSERT(
sizeof(TT)<=
sizeof(_wrap.blob));
111 new (_wrap.blob) TT(v);
125 #if __cplusplus>=201103L
131 inline AnyScalar&
operator=(
const AnyScalar& o) {
132 AnyScalar(o).swap(*
this);
138 AnyScalar(v).swap(*
this);
142 #if __cplusplus>=201103L
143 inline AnyScalar&
operator=(AnyScalar&& o) noexcept {
155 void swap(AnyScalar& o);
162 inline void* unsafe() {
return _wrap.blob; }
163 inline const void* unsafe()
const {
return _wrap.blob; }
167 #if __cplusplus>=201103L
168 explicit operator bool()
const {
return !
empty(); }
171 typedef void (AnyScalar::*bool_type)(AnyScalar&);
173 operator bool_type()
const {
return !
empty() ? &AnyScalar::swap : 0; }
179 const void* bufferUnsafe()
const;
193 typename detail::any_storage_type<typename meta::strip_const<T>::type>::type&
195 typedef typename meta::strip_const<T>::type T2;
196 typedef typename detail::any_storage_type<T2>::type TT;
200 return reinterpret_cast<TT&
>(_wrap.blob);
216 typedef typename meta::strip_const<T>::type T2;
217 typedef typename detail::any_storage_type<T2>::type TT;
221 return reinterpret_cast<typename meta::decorate_const<TT>::type&
>(_wrap.blob);
231 typedef typename meta::strip_const<T>::type T2;
232 typedef typename detail::any_storage_type<T2>::type TT;
251 #endif // PV_ANYSCALAR_H
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
ScalarType type() const
Type code of contained value. Or (ScalarType)-1 is empty.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
AnyScalar(T v)
Construct from provided value.
constexpr complex< _Tp > & operator=(const _Tp &)
detail::any_storage_type< typename meta::strip_const< T >::type >::type & ref()
basic_string< char > string
meta::decorate_const< typename detail::any_storage_type< typename meta::strip_const< T >::type >::type >::type & ref() const
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())