00001 00002 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00003 #error This is an internal header file used to implement Instigate Open Source.\ 00004 It should never be included directly by a program. 00005 #endif 00006 00007 #ifndef INSTIGATE_GENERIC_EQUALITY_COMPARABLE_HPP 00008 #define INSTIGATE_GENERIC_EQUALITY_COMPARABLE_HPP 00009 00032 // Headers from this project 00033 00034 // Headers from other projects 00035 00036 // Headers from standard libraries 00037 00038 // Forward declarations 00039 namespace instigate { 00040 namespace generic { 00049 namespace equality_comparable { 00050 struct tag; 00051 template <typename T> struct interface; 00052 template <typename T> struct requirements; 00053 } 00054 } 00055 } 00056 00063 struct instigate::generic::equality_comparable::tag 00064 { 00065 }; 00066 00071 template<typename T> 00072 struct instigate::generic::equality_comparable::interface 00073 { 00083 static bool equal(const T& a, const T& b) 00084 { 00085 return a == b; 00086 } 00087 }; 00088 00096 template<typename T> 00097 struct instigate::generic::equality_comparable::requirements 00098 { 00103 static void return_type_must_be_convertible_to_bool(const T& a, 00104 const T& b) 00105 { 00106 (bool)instigate::generic::equality_comparable:: 00107 interface<T>::equal(a, b); 00108 } 00109 00114 static void require_equal(const T& a, const T& b) 00115 { 00116 instigate::generic::equality_comparable::interface<T>::equal(a, b); 00117 } 00118 00126 requirements() 00127 { 00128 (void)return_type_must_be_convertible_to_bool; 00129 (void)require_equal; 00130 } 00131 }; 00132 00133 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00134 00135 #endif // INSTIGATE_GENERIC_EQUALITY_COMPARABLE_HPP