12 #ifndef BOOST_MPL11_CORE_HPP
13 #define BOOST_MPL11_CORE_HPP
23 namespace boost {
namespace mpl11 {
25 namespace core_detail {
26 template <
typename ...xs>
28 static_assert(detail::dependent<xs...>::value(
false),
29 "Error: `undefined` may not be instantiated.");
36 template <
template <
typename ...>
class Typeclass>
38 template <
typename ...>
53 namespace core_detail {
55 auto pick_datatype(T*) ->
typename T::mpl_datatype;
56 auto pick_datatype(...) -> Foreign;
59 template <
typename ctor>
61 using type = decltype(core_detail::pick_datatype((ctor*)
nullptr));
67 template <
typename To>
72 using apply =
typename cast<
73 typename datatype<x>::type, To
74 >::type::template apply<x>;
80 namespace core_detail {
88 using mpl_datatype = Foreign;
92 template <
typename From>
93 struct cast<From, Foreign> {
97 using apply = core_detail::foreign<x>;
103 struct cast<Foreign, Foreign> : lift<box> { };
112 namespace boost {
namespace mpl11 {
114 namespace core_detail {
115 template <
typename ...datatypes>
116 struct invalid_cast {
117 static_assert(detail::dependent<datatypes...>::value(
false),
118 "No cast is provided between the two requested datatypes.");
125 template <
typename From,
typename To>
127 :
if_c<detail::std_is_same<From, To>::value,
129 core_detail::invalid_cast<From, To>
134 #endif // !BOOST_MPL11_CORE_HPP
Boxes its argument.
Definition: core.hpp:46
Returns the datatype of the given data constructor.
Definition: core.hpp:60
Forward declares the Core module.
Holds default methods of typeclasses.
Definition: core.hpp:37
Forwards to boost/mpl11/fwd/integer.hpp.
Forward declares logical metafunctions.
Defines the Logical module.
Defines boost::mpl11::detail::dependent.
Defines boost::mpl11::detail::std_is_same.
Metafunction class converting an object of the From datatype to an object of the To datatype...
Definition: core.hpp:126
Equivalent to if_, Then, Else>.
Definition: logical.hpp:63
Invokes a metafunction class with the given arguments.
Definition: functional.hpp:39
Metafunction class converting an object to the To datatype.
Definition: core.hpp:68
Alias to bool_; provided for convenience.
Definition: integer.hpp:79
Forwards to boost/mpl11/integer.hpp.
Defines the Functional module.