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