00001 00002 00003 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00004 #error This is an internal header file used to implement Instigate STL.\ 00005 It should never be included directly by a program. 00006 #endif 00007 00008 00009 #ifndef INSTIGATE_STL_PAIR_HPP 00010 #define INSTIGATE_STL_PAIR_HPP 00011 00059 // Headers from this project 00060 #include "concept.hpp" 00061 00062 // Headers from other project 00063 #include <generic/base.hpp> 00064 00065 // Headers from standard libraries 00066 00067 // Forward declarations 00068 namespace instigate { 00069 namespace stl { 00073 namespace pair { 00074 template <typename T> struct interface; 00075 template <typename T> struct requirements; 00076 } 00077 } 00078 } 00079 00090 template<typename T> 00091 struct instigate::stl::pair::interface 00092 { 00094 typedef typename T::first_type first_type; 00095 00097 typedef typename T::second_type second_type; 00098 00105 static void set_first(T& a, const first_type& f) 00106 { 00107 instigate::generic::assignable::interface<first_type>:: 00108 assign(a.first, f); 00109 } 00110 00117 static void set_second(T& a, const second_type& s) 00118 { 00119 instigate::generic::assignable::interface<second_type>:: 00120 assign(a.second, s); 00121 } 00122 }; 00123 00131 template<typename T> 00132 struct instigate::stl::pair::requirements 00133 { 00138 static void require_first_type() 00139 { 00140 typedef typename instigate::stl::pair::interface<T>:: 00141 first_type first; 00142 } 00143 00148 static void require_second_type() 00149 { 00150 typedef typename instigate::stl::pair::interface<T>:: 00151 second_type second; 00152 } 00157 static void require_set_first(T& a, const typename instigate::stl:: 00158 pair::interface<T>::first_type& f) 00159 { 00160 instigate::stl::pair::interface<T>::set_first(a, f); 00161 } 00162 00167 static void require_set_second(T& a, const typename instigate::stl:: 00168 pair::interface<T>::second_type& s) 00169 { 00170 instigate::stl::pair::interface<T>::set_second(a, s); 00171 } 00172 00179 requirements() 00180 { 00181 namespace STL = instigate::stl; 00182 CHECK(instigate::generic::assignable::requirements<typename 00183 STL::pair::interface<T>::first_type>); 00184 CHECK(instigate::generic::assignable::requirements<typename 00185 STL::pair::interface<T>::second_type>); 00186 (void)&require_first_type; 00187 (void)&require_second_type; 00188 (void)&require_set_first; 00189 (void)&require_set_second; 00190 } 00191 }; 00192 00193 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00194 00195 #endif // INSTIGATE_STL_PAIR_hpp