1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/Algorithm.h
12 #ifndef ZYPP_BASE_ALGORITHM_H
13 #define ZYPP_BASE_ALGORITHM_H
17 ///////////////////////////////////////////////////////////////////
19 { /////////////////////////////////////////////////////////////////
21 /** Iterate through <tt>[begin_r,end_r)</tt> and invoke \a fnc_r
22 * on each item that passes \a filter_r.
24 * Iteration aborts if \a fnc_r returns \c false.
26 * \return Number of invokations of \a fnc_r, negative if
27 * loop was aborted by \a fnc_.
29 template <class _Iterator, class _Filter, class _Function>
30 inline int invokeOnEach( _Iterator begin_r, _Iterator end_r,
35 for ( _Iterator it = begin_r; it != end_r; ++it )
37 if ( filter_r( *it ) )
47 /** Iterate through <tt>[begin_r,end_r)</tt> and invoke \a fnc_r
50 * Iteration aborts if \a fnc_r returns \c false.
52 * \return Number of invokations of \a fnc_r, negative if
53 * loop was aborted by \a fnc_.
55 template <class _Iterator, class _Function>
56 inline int invokeOnEach( _Iterator begin_r, _Iterator end_r,
60 for ( _Iterator it = begin_r; it != end_r; ++it )
69 /////////////////////////////////////////////////////////////////
71 ///////////////////////////////////////////////////////////////////
72 #endif // ZYPP_BASE_ALGORITHM_H