00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #ifndef STLSOFT_INCL_H_STLSOFT
00060 # include "stlsoft.h"
00061 #endif
00062 #include <functional>
00063
00064
00065
00066
00067
00068 #ifndef _STLSOFT_NO_NAMESPACE
00069 namespace stlsoft
00070 {
00071 #endif
00072
00073
00074
00075
00076
00077
00078
00080
00081 template <ss_typename_param_k T>
00082 struct noop_function
00083 : public stlsoft_ns_qual_std(unary_function)<T const &, void>
00084 {
00085 public:
00087 void operator ()(T const &) stlsoft_throw_0()
00088 {}
00089 };
00090
00091
00092
00093
00095
00096 template <ss_typename_param_k T>
00097 struct delete_instance
00098 : public stlsoft_ns_qual_std(unary_function)<T *, void>
00099 {
00100 public:
00104 void operator ()(T *pt) stlsoft_throw_0()
00105 {
00106 delete pt;
00107 }
00108 };
00109
00110
00111
00112
00114
00115 template <ss_typename_param_k T>
00116 struct delete_array
00117 : public stlsoft_ns_qual_std(unary_function)<T [], void>
00118 {
00119 public:
00123 void operator ()(T t[]) stlsoft_throw_0()
00124 {
00125 delete [] t;
00126 }
00127 };
00128
00129
00130
00131
00143 template< ss_typename_param_k F
00144 #ifndef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00145 , ss_typename_param_k T
00146 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00147 >
00148 struct select_1st
00149 : public stlsoft_ns_qual_std(unary_function)< ss_typename_type_k F::argument_type
00150 , ss_typename_type_k F::result_type>
00151 {
00152 public:
00154 select_1st()
00155 : m_f()
00156 {}
00157
00160 ss_explicit_k select_1st(F f)
00161 : m_f(f)
00162 {}
00163
00168
00169
00170 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00171 template <ss_typename_param_k T>
00172 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00173 void operator ()(T &t)
00174 {
00175 m_f(t.first);
00176 }
00177
00178
00179 private:
00180 F m_f;
00181 };
00182
00183 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00184 template< ss_typename_param_k F
00185 >
00186 inline select_1st<F> make_1st_selector(F f)
00187 {
00188 return select_1st<F>(f);
00189 }
00190 #else
00191
00192 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00193
00194
00195
00209
00210 template< ss_typename_param_k F
00211 #ifndef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00212 , ss_typename_param_k T
00213 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00214 >
00215 struct select_2nd
00216 : public stlsoft_ns_qual_std(unary_function)<ss_typename_type_k F::argument_type, ss_typename_type_k F::result_type>
00217 {
00218 public:
00220 select_2nd()
00221 : m_f()
00222 {}
00223
00226 ss_explicit_k select_2nd(F f)
00227 : m_f(f)
00228 {}
00229
00234
00235
00236 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00237 template <ss_typename_param_k T>
00238 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00239 void operator ()(T &t)
00240 {
00241 m_f(t.second);
00242 }
00243
00244
00245 private:
00246 F m_f;
00247 };
00248
00249
00250
00251
00264
00265 template< ss_typename_param_k F1
00266 , ss_typename_param_k F2
00267 #ifndef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00268 , ss_typename_param_k T
00269 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00270 >
00271 struct select_both
00272 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00273 : public stlsoft_ns_qual_std(unary_function)<void, void>
00274 #else
00275 : public stlsoft_ns_qual_std(unary_function)<T &, void>
00276 #endif
00277 {
00278 public:
00280 select_both()
00281 : m_f1()
00282 , m_f2()
00283 {}
00284
00287 ss_explicit_k select_both(F1 f1, F2 f2)
00288 : m_f1(f1)
00289 , m_f2(f2)
00290 {}
00291
00296
00297
00298 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00299 template <ss_typename_param_k T>
00300 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00301 void operator ()(T &t)
00302 {
00303 m_f1(t.first);
00304 m_f2(t.second);
00305 }
00306
00307
00308 private:
00309 F1 m_f1;
00310 F2 m_f2;
00311 };
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324