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_ADDITIVE_MAGMA_HPP 00008 #define INSTIGATE_ALGEBRA_ADDITIVE_MAGMA_HPP 00009 00034 // Headers from this project 00035 #include "interface.hpp" 00036 00037 // Headers from other projects 00038 #include <generic/_assignable.hpp> 00039 #include <generic/base.hpp> 00040 00041 // Headers from standard libraries 00042 00043 // Forward declarations 00044 00048 namespace instigate { 00049 00053 namespace algebra { 00054 00068 namespace additive_magma { 00069 struct tag; 00070 template <typename T> struct interface; 00071 template <typename T> struct requirements; 00072 00073 } // namespace instigate::algebra::additive_magma 00074 00075 } // namespace instigate::algebra 00076 00077 } // namespace instigate 00078 00085 struct instigate::algebra::additive_magma::tag : 00086 instigate::assignable::tag {}; 00087 00092 template <typename T> 00093 struct instigate::algebra::additive_magma::interface : 00094 instigate::assignable::interface<T> 00095 { 00104 static T plus(const T& a, const T& b) 00105 { 00106 return instigate::algebra::interface<T>::plus(a, b); 00107 } 00108 }; 00109 00118 template <typename T> 00119 struct instigate::algebra::additive_magma::requirements : 00120 instigate::assignable::requirements<T> 00121 { 00122 00127 static void require_plus(const T& a, const T& b) 00128 { 00129 instigate::algebra::additive_magma::interface<T>::plus(a, b); 00130 } 00131 00136 static void require_plus_return_type(const T& a, const T& b) 00137 { 00138 REQUIRE_SAME_TYPE(a, interface<T>::plus(a, b)); 00139 } 00140 00147 requirements() 00148 { 00149 (void)&require_plus; 00150 (void)&require_plus_return_type; 00151 } 00152 }; 00153 00154 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00155 00156 #endif // INSTIGATE_ALGEBRA_ADDITIVE_MAGMA_HPP