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
00048 #ifndef STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS
00049 #define STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS_MAJOR 2
00053 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS_MINOR 0
00054 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS_REVISION 2
00055 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_PROCEDURE_ADAPTORS_EDIT 14
00056 #endif
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00067 # include <stlsoft/stlsoft.h>
00068 #endif
00069
00070 #ifndef STLSOFT_INCL_FUNCTIONAL
00071 # define STLSOFT_INCL_FUNCTIONAL
00072 # include <functional>
00073 #endif
00074
00075
00076
00077
00078
00079 #ifndef _STLSOFT_NO_NAMESPACE
00080 namespace stlsoft
00081 {
00082 #endif
00083
00084
00085
00086
00087
00093
00094 template <ss_typename_param_k F>
00095 struct unary_procedure_adaptor
00096 : public stlsoft_ns_qual_std(unary_function)< ss_typename_type_k F::argument_type
00097 , void>
00098 {
00099 private:
00100 typedef F adapted_function_type;
00101 public:
00102 typedef ss_typename_type_k F::argument_type argument_type;
00103 typedef void result_type;
00104
00105 public:
00106 unary_procedure_adaptor(adapted_function_type func)
00107 : m_func(func)
00108 {}
00109
00110 public:
00111 void operator ()(argument_type arg) const
00112 {
00113 static_cast<void>(m_func(arg));
00114 }
00115
00116 private:
00117 adapted_function_type m_func;
00118 };
00119
00125
00126 template <ss_typename_param_k F>
00127 struct binary_procedure_adaptor
00128 : public std::binary_function< ss_typename_type_k F::first_argument_type
00129 , ss_typename_type_k F::second_argument_type
00130 , void>
00131 {
00132 private:
00133 typedef F adapted_function_type;
00134 public:
00135 typedef ss_typename_type_k F::first_argument_type first_argument_type;
00136 typedef ss_typename_type_k F::second_argument_type second_argument_type;
00137 typedef void result_type;
00138
00139 public:
00140 binary_procedure_adaptor(adapted_function_type func)
00141 : m_func(func)
00142 {}
00143
00144 public:
00145 void operator ()(first_argument_type arg1, second_argument_type arg2) const
00146 {
00147 static_cast<void>(m_func(arg1, arg2));
00148 }
00149
00150 private:
00151 adapted_function_type m_func;
00152 };
00153
00154
00155
00156
00157
00162 template <ss_typename_param_k F>
00163 inline unary_procedure_adaptor<F> adapt_unary_procedure(F func)
00164 {
00165 return unary_procedure_adaptor<F>(func);
00166 }
00167
00172 template <ss_typename_param_k F>
00173 inline binary_procedure_adaptor<F> adapt_binary_procedure(F func)
00174 {
00175 return binary_procedure_adaptor<F>(func);
00176 }
00177
00178
00179
00180 #ifndef _STLSOFT_NO_NAMESPACE
00181 }
00182 #endif
00183
00184
00185
00186 #endif
00187
00188