MPL11
 All Classes Namespaces Files Typedefs Macros Groups Pages
field.hpp
Go to the documentation of this file.
1 
12 #ifndef BOOST_MPL11_FIELD_HPP
13 #define BOOST_MPL11_FIELD_HPP
14 
16 
17 #include <boost/mpl11/bool.hpp>
18 #include <boost/mpl11/core.hpp>
19 #include <boost/mpl11/fwd/ring.hpp>
20 
21 
22 namespace boost { namespace mpl11 {
23  template <typename Left, typename Right, typename>
24  struct Field : false_ { };
25 
26  template <>
27  struct instantiate<Field> {
28  template <typename Left, typename Right = Left>
29  struct with;
30 
31  template <typename Datatype>
32  struct with<Datatype> : true_ {
33  template <typename x, typename y>
34  using quot_impl = mult<box<x>, recip<box<y>>>;
35 
36  template <typename x>
37  using recip_impl = quot<one<Datatype>, box<x>>;
38  };
39  };
40 
41  template <typename x, typename y>
42  struct quot :
43  Field<
44  typename datatype<typename x::type>::type,
45  typename datatype<typename y::type>::type
46  >::template quot_impl<typename x::type, typename y::type>
47  { };
48 
49  template <typename x>
50  struct recip :
51  Field<typename datatype<typename x::type>::type>::
52  template recip_impl<typename x::type>
53  { };
54 }} // end namespace boost::mpl11
55 
56 #endif // !BOOST_MPL11_FIELD_HPP
Forward declares the Field typeclass.
Multiplicative inverse of x.
Definition: field.hpp:50
Defines the Core module.
Multiplication of x by the multiplicative inverse of y.
Definition: field.hpp:42
Forwards to boost/mpl11/integer.hpp.
Forward declares the Ring typeclass.