12#ifndef ZYPP_BASE_ALGORITHM_H
13#define ZYPP_BASE_ALGORITHM_H
29 template <
class TIterator,
class TFilter,
class TFunction>
35 for ( TIterator it = begin_r; it != end_r; ++it )
37 if ( filter_r( *it ) )
55 template <
class TIterator,
class TFunction>
60 for ( TIterator it = begin_r; it != end_r; ++it )
69 template <
class Container,
class Elem>
70 bool contains (
const Container &c,
const Elem &elem )
72 return ( std::find( c.begin(), c.end(), elem ) != c.end() );
75 template <
class Container,
class Fnc >
76 bool any_of (
const Container &c, Fnc &&cb )
78 return std::any_of( c.begin(), c.end(), std::forward<Fnc>(cb) );
Easy-to use interface to the ZYPP dependency resolver.
bool any_of(const Container &c, Fnc &&cb)
bool contains(const Container &c, const Elem &elem)
int invokeOnEach(TIterator begin_r, TIterator end_r, TFilter filter_r, TFunction fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.