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_RING_HPP 00008 #define INSTIGATE_ALGEBRA_RING_HPP 00009 00033 // Headers from this project 00034 #include "_commutativity_addition.hpp" 00035 #include "_additive_group.hpp" 00036 #include "_multiplicative_monoid.hpp" 00037 #include "interface.hpp" 00038 00039 // Headers from other projects 00040 #include <generic/base.hpp> 00041 00042 // Headers from standard libraries 00043 00044 // Forward declarations 00045 namespace instigate { 00046 00047 namespace algebra { 00048 00062 namespace ring { 00063 struct tag; 00064 template <typename T> struct interface; 00065 template <typename T> struct requirements; 00066 00067 } // namespace instigate::algebra::ring 00068 00069 } // namespace instigate::algebra 00070 00071 } // namespace instigate 00072 00079 struct instigate::algebra::ring::tag : 00080 instigate::algebra::multiplicative_monoid::tag, 00081 instigate::algebra::additive_group::tag, 00082 instigate::algebra::commutativity_addition::tag {}; 00083 00085 template <typename T> 00086 struct instigate::algebra::ring::interface : 00087 instigate::algebra::multiplicative_monoid::interface<T>, 00088 instigate::algebra::commutativity_addition::interface<T>, 00089 instigate::algebra::additive_group::interface<T> 00090 { 00095 static const bool is_specialized = instigate::algebra::interface<T>:: 00096 is_distributivity; 00097 }; 00098 00106 template <typename T> 00107 struct instigate::algebra::ring::requirements : 00108 instigate::algebra::multiplicative_monoid::requirements<T>, 00109 instigate::algebra::commutativity_addition::requirements<T>, 00110 instigate::algebra::additive_group::requirements<T> 00111 { 00113 static void require_distributivity() 00114 { 00115 CHECK(instigate::generic::require<instigate:: 00116 algebra::ring::interface<T>::is_specialized>); 00117 } 00118 00125 requirements() 00126 { 00127 (void)&require_distributivity; 00128 } 00129 }; 00130 00131 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00132 00133 #endif // INSTIGATE_ALGEBRA_RING_HPP