Warning, file /include/boost/type_erasure/builtin.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_TYPE_ERASURE_BUILTIN_HPP_INCLUDED
0012 #define BOOST_TYPE_ERASURE_BUILTIN_HPP_INCLUDED
0013
0014 #include <boost/mpl/vector.hpp>
0015 #include <boost/utility/enable_if.hpp>
0016 #include <boost/type_traits/is_reference.hpp>
0017 #include <boost/type_erasure/detail/storage.hpp>
0018 #include <boost/type_erasure/placeholder.hpp>
0019 #include <boost/type_erasure/constructible.hpp>
0020 #include <boost/type_erasure/rebind_any.hpp>
0021 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0022 # include <utility> // std::move
0023 #endif
0024 #include <typeinfo>
0025
0026 namespace boost {
0027 namespace type_erasure {
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 template<class T = _self>
0043 struct destructible
0044 {
0045
0046 typedef void (*type)(detail::storage&);
0047
0048 static void value(detail::storage& arg)
0049 {
0050 delete static_cast<T*>(arg.data);
0051 }
0052
0053 static void apply(detail::storage& arg)
0054 {
0055 delete static_cast<T*>(arg.data);
0056 }
0057 };
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 template<class T = _self>
0068 struct copy_constructible :
0069 ::boost::mpl::vector<constructible<T(const T&)>, destructible<T> >
0070 {};
0071
0072 #ifdef BOOST_TYPE_ERASURE_DOXYGEN
0073
0074
0075
0076
0077 template<class T = _self, class U = const T&>
0078 struct assignable
0079 {
0080 static void apply(T& dst, U src);
0081 };
0082
0083 #else
0084
0085
0086
0087
0088 template<class T = _self, class U = const T&>
0089 struct assignable :
0090 ::boost::mpl::vector<assignable<T, const U&> >
0091 {};
0092
0093 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0094
0095
0096 template<class T, class U>
0097 struct assignable<T, U&&>
0098 {
0099 static void apply(T& dst, U&& src) { dst = std::forward<U>(src); }
0100 };
0101
0102 #endif
0103
0104
0105 template<class T, class U>
0106 struct assignable<T, U&>
0107 {
0108 static void apply(T& dst, U& src) { dst = src; }
0109 };
0110
0111
0112 template<class T, class U, class Base>
0113 struct concept_interface<assignable<T, U>, Base, T,
0114 typename ::boost::enable_if_c< ::boost::is_reference<U>::value>::type> : Base
0115 {
0116 using Base::_boost_type_erasure_deduce_assign;
0117 assignable<T, U>* _boost_type_erasure_deduce_assign(
0118 typename ::boost::type_erasure::as_param<Base, U>::type)
0119 {
0120 return 0;
0121 }
0122 };
0123
0124 #endif
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 template<class T = _self>
0138 struct typeid_
0139 {
0140
0141 typedef const std::type_info& (*type)();
0142
0143 static const std::type_info& value()
0144 {
0145 return typeid(T);
0146 }
0147
0148 static const std::type_info& apply()
0149 {
0150 return typeid(T);
0151 }
0152 };
0153
0154 namespace detail {
0155
0156 template<class C>
0157 struct get_null_vtable_entry;
0158
0159 template<class T>
0160 struct get_null_vtable_entry< ::boost::type_erasure::typeid_<T> >
0161 {
0162 typedef typeid_<void> type;
0163 };
0164
0165 struct null_destroy {
0166 static void value(::boost::type_erasure::detail::storage&) {}
0167 };
0168
0169 template<class T>
0170 struct get_null_vtable_entry< ::boost::type_erasure::destructible<T> >
0171 {
0172 typedef ::boost::type_erasure::detail::null_destroy type;
0173 };
0174
0175 }
0176
0177 }
0178 }
0179
0180 #endif