From 484213e42d09f2dc6366db715e6e60f9f36bd463 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 29 Dec 2009 05:34:32 +0100 Subject: [PATCH] Implementation draft --- tests/lib/util-foreach-test.cpp | 111 ++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/tests/lib/util-foreach-test.cpp b/tests/lib/util-foreach-test.cpp index a1f5294e8..0f25c91ea 100644 --- a/tests/lib/util-foreach-test.cpp +++ b/tests/lib/util-foreach-test.cpp @@ -49,6 +49,117 @@ using namespace boost::lambda; namespace util { +///////////////////////////////////////////////////////////////////////////TODO: Implementation draft + + using std::tr1::bind; + + template < typename CON, typename FUN + , typename P1 + > + inline void //________________________________ + for_each (CON& elements, FUN function, P1 bind1) ///< Accept binding for 1 Argument + { + for_each (elements, std::tr1::bind (function, bind1)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + > + inline void //________________________________ + for_each (CON& elements, FUN function, P1 bind1, P2 bind2) ///< Accept binding for 2 Arguments + { + for_each (elements, std::tr1::bind (function, bind1, bind2)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + , typename P3 + > + inline void //________________________________ + for_each (CON& elements, FUN function, P1 bind1, P2 bind2, P3 bind3) ///< Accept binding for 3 Arguments + { + for_each (elements, std::tr1::bind (function, bind1, bind2, bind3)); + } + + + + + + template < typename CON, typename FUN + , typename P1 + > + inline bool //________________________________ + and_all (CON& elements, FUN function, P1 bind1) ///< Accept binding for 1 Argument + { + return and_all (elements, std::tr1::bind (function, bind1)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + > + inline bool //________________________________ + and_all (CON& elements, FUN function, P1 bind1, P2 bind2) ///< Accept binding for 2 Arguments + { + return and_all (elements, std::tr1::bind (function, bind1, bind2)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + , typename P3 + > + inline bool //________________________________ + and_all (CON& elements, FUN function, P1 bind1, P2 bind2, P3 bind3) ///< Accept binding for 3 Arguments + { + return and_all (elements, std::tr1::bind (function, bind1, bind2, bind3)); + } + + + + + + template < typename CON, typename FUN + , typename P1 + > + inline bool //________________________________ + has_any (CON& elements, FUN function, P1 bind1) ///< Accept binding for 1 Argument + { + return has_any (elements, std::tr1::bind (function, bind1)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + > + inline bool //________________________________ + has_any (CON& elements, FUN function, P1 bind1, P2 bind2) ///< Accept binding for 2 Arguments + { + return has_any (elements, std::tr1::bind (function, bind1, bind2)); + } + + + template < typename CON, typename FUN + , typename P1 + , typename P2 + , typename P3 + > + inline bool //________________________________ + has_any (CON& elements, FUN function, P1 bind1, P2 bind2, P3 bind3) ///< Accept binding for 3 Arguments + { + return has_any (elements, std::tr1::bind (function, bind1, bind2, bind3)); + } + + + +///////////////////////////////////////////////////////////////////////////TODO: Implementation draft (END) namespace test { typedef std::vector VecI;