00001 00002 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00003 #error This is an internal header file used to implement Instigate Algebra.\ 00004 It should never be included directly by a program. 00005 #endif 00006 00007 #ifndef INSTIGATE_ALGEBRA_MULTIPLICATIVE_GROUP 00008 #define INSTIGATE_ALGEBRA_MULTIPLICATIVE_GROUP 00009 00034 // Headers from this project 00035 #include "_multiplicative_monoid.hpp" 00036 00037 // Headers from other projects 00038 #include <generic/base.hpp> 00039 // Headers from standard libraries 00040 00041 // Forward declarations 00042 namespace instigate { 00043 00044 namespace algebra { 00045 00067 namespace multiplicative_group { 00068 struct tag; 00069 template <typename T> struct interface; 00070 template <typename T> struct requirements; 00071 00072 } // namespace instigate::algebra::multiplicative_group 00073 00074 } // namespace instigate::algebra 00075 00076 } // namespace instigate 00077 00084 struct instigate::algebra::multiplicative_group::tag : 00085 instigate::algebra::multiplicative_monoid::tag {}; 00086 00091 template <typename T> 00092 struct instigate::algebra::multiplicative_group::interface : 00093 instigate::algebra::multiplicative_monoid::interface<T> 00094 { 00103 static T divide(const T& a, const T& b) 00104 { 00105 return instigate::algebra::interface<T>::divide(a, b); 00106 } 00107 00115 static T inverse(const T& a) 00116 { 00117 return instigate::algebra::interface<T>::inverse(a); 00118 } 00119 }; 00120 00129 template <typename T> 00130 struct instigate::algebra::multiplicative_group::requirements : 00131 instigate::algebra::multiplicative_monoid::requirements<T> 00132 { 00137 static void require_inverse(const T& a) 00138 { 00139 instigate::algebra::multiplicative_group::interface<T>:: 00140 inverse(a); 00141 } 00142 00147 static void require_inverse_return_type(const T& a) 00148 { 00149 REQUIRE_SAME_TYPE(a, interface<T>::inverse(a)); 00150 } 00151 00156 static void require_divide(const T& a, const T& b) 00157 { 00158 instigate::algebra::multiplicative_group::interface<T>:: 00159 divide(a, b); 00160 } 00161 00166 static void require_divide_return_type(const T& a, const T& b) 00167 { 00168 REQUIRE_SAME_TYPE(a, interface<T>::divide(a, b)); 00169 } 00170 00177 requirements() 00178 { 00179 (void)&require_inverse; 00180 (void)&require_inverse_return_type; 00181 (void)&require_divide; 00182 (void)&require_divide_return_type; 00183 } 00184 }; 00185 00186 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00187 00188 #endif // INSTIGATE_ALGEBRA_MULTIPLICATIVE_GROUP