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_COMPOSITE_PREDICATES
00049 #define STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_COMPOSITE_PREDICATES
00050 
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_COMPOSITE_PREDICATES_MAJOR      1
00053 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_COMPOSITE_PREDICATES_MINOR      1
00054 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_COMPOSITE_PREDICATES_REVISION   1
00055 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_COMPOSITE_PREDICATES_EDIT       3
00056 #endif 
00057 
00058 
00059 
00060 
00061 
00062 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00063 # include <stlsoft/stlsoft.h>
00064 #endif 
00065 
00066 #ifdef STLSOFT_CF_std_NAMESPACE
00067 # include <functional>
00068 #endif 
00069 
00070 
00071 
00072 
00073 
00074 #ifndef _STLSOFT_NO_NAMESPACE
00075 namespace stlsoft
00076 {
00077 #endif 
00078 
00079 
00080 
00081 
00082 
00089 template<   ss_typename_param_k P1
00090         ,   ss_typename_param_k P2
00091         >
00092 
00093 struct any_of_tester
00094 #ifdef STLSOFT_CF_std_NAMESPACE
00095     : public stlsoft_ns_qual_std(unary_function)<ss_typename_type_k P1::argument_type, ss_bool_t>
00096 #endif 
00097 {
00098 private:
00099     typedef ss_typename_type_k P1::argument_type    arg_type;
00100 
00101 public:
00102     any_of_tester(P1 p1, P2 p2)
00103         : m_p1(p1)
00104         , m_p2(p2)
00105     {}
00106 
00107 public:
00109     ss_bool_t operator ()(arg_type a) const
00110     {
00111         return m_p1(a) || m_p2(a);
00112     }
00113 
00114 private:
00115     P1  m_p1;
00116     P2  m_p2;
00117 };
00118 
00119 template<   ss_typename_param_k P1
00120         ,   ss_typename_param_k P2
00121         >
00122 inline any_of_tester<P1, P2> any_of(P1 p1, P2 p2)
00123 {
00124     return any_of_tester<P1, P2>(p1, p2);
00125 }
00126 
00127 template<   ss_typename_param_k P1
00128         ,   ss_typename_param_k P2
00129         ,   ss_typename_param_k P3
00130         >
00131 inline any_of_tester<P1, any_of_tester<P2, P3> > any_of(P1 p1, P2 p2, P3 p3)
00132 {
00133     return any_of(p1, any_of(p2, p3));
00134 }
00135 
00136 template<   ss_typename_param_k P1
00137         ,   ss_typename_param_k P2
00138         ,   ss_typename_param_k P3
00139         ,   ss_typename_param_k P4
00140         >
00141 inline any_of_tester<any_of_tester<P1, P2>, any_of_tester<P3, P4> > any_of(P1 p1, P2 p2, P3 p3, P4 p4)
00142 {
00143     return any_of(any_of(p1, p2), any_of(p3, p4));
00144 }
00145 
00152 template<   ss_typename_param_k P1
00153         ,   ss_typename_param_k P2
00154         >
00155 
00156 struct all_of_tester
00157 #ifdef STLSOFT_CF_std_NAMESPACE
00158     : public stlsoft_ns_qual_std(unary_function)<ss_typename_type_k P1::argument_type, ss_bool_t>
00159 #endif 
00160 {
00161 private:
00162     typedef ss_typename_type_k P1::argument_type    arg_type;
00163 
00164 public:
00165     all_of_tester(P1 p1, P2 p2)
00166         : m_p1(p1)
00167         , m_p2(p2)
00168     {}
00169 
00170 public:
00172     ss_bool_t operator ()(arg_type a) const
00173     {
00174         return m_p1(a) && m_p2(a);
00175     }
00176 
00177 private:
00178     P1  m_p1;
00179     P2  m_p2;
00180 };
00181 
00182 template<   ss_typename_param_k P1
00183         ,   ss_typename_param_k P2
00184         >
00185 inline all_of_tester<P1, P2> all_of(P1 p1, P2 p2)
00186 {
00187     return all_of_tester<P1, P2>(p1, p2);
00188 }
00189 
00190 template<   ss_typename_param_k P1
00191         ,   ss_typename_param_k P2
00192         ,   ss_typename_param_k P3
00193         >
00194 inline all_of_tester<P1, all_of_tester<P2, P3> > all_of(P1 p1, P2 p2, P3 p3)
00195 {
00196     return all_of(p1, all_of(p2, p3));
00197 }
00198 
00199 template<   ss_typename_param_k P1
00200         ,   ss_typename_param_k P2
00201         ,   ss_typename_param_k P3
00202         ,   ss_typename_param_k P4
00203         >
00204 inline all_of_tester<all_of_tester<P1, P2>, all_of_tester<P3, P4> > all_of(P1 p1, P2 p2, P3 p3, P4 p4)
00205 {
00206     return all_of(all_of(p1, p2), all_of(p3, p4));
00207 }
00208 
00209 
00210 
00211 #ifndef _STLSOFT_NO_NAMESPACE
00212 } 
00213 #endif 
00214 
00215 
00216 
00217 #endif 
00218 
00219