12 #ifndef ZYPP_BASE_ITERATOR_H
13 #define ZYPP_BASE_ITERATOR_H
18 #include <boost/functional.hpp>
19 #include <boost/iterator/filter_iterator.hpp>
20 #include <boost/iterator/transform_iterator.hpp>
21 #include <boost/function_output_iterator.hpp>
93 using boost::filter_iterator;
94 using boost::make_filter_iterator;
97 template<
class _Filter,
class _Container>
101 return make_filter_iterator( f, c.begin(), c.end() );
105 template<
class _Filter,
class _Container>
109 return make_filter_iterator( _Filter(), c.begin(), c.end() );
113 template<
class _Filter,
class _Container>
117 return make_filter_iterator( f, c.end(), c.end() );
121 template<
class _Filter,
class _Container>
125 return make_filter_iterator( _Filter(), c.end(), c.end() );
146 using boost::transform_iterator;
147 using boost::make_transform_iterator;
152 template<
class _Pair>
153 struct GetPairFirst :
public std::unary_function<_Pair, const typename _Pair::first_type &>
155 const typename _Pair::first_type &
operator()(
const _Pair & pair_r )
const
156 {
return pair_r.first; }
162 template<
class _Pair>
163 struct GetPairSecond :
public std::unary_function<_Pair, const typename _Pair::second_type &>
165 const typename _Pair::second_type &
operator()(
const _Pair & pair_r )
const
166 {
return pair_r.second; }
215 typedef transform_iterator<GetPairFirst<typename MapType::value_type>,
220 typedef transform_iterator<GetPairSecond<typename MapType::value_type>,
278 using boost::function_output_iterator;
279 using boost::make_function_output_iterator;
285 #endif // ZYPP_BASE_ITERATOR_H
MapKVIteratorTraits< _Map >::Value_const_iterator make_map_value_end(const _Map &map_r)
Convenience to create the value iterator from container::end()
Functor taking a std::pair returning std::pair.second .
MapKVIteratorTraits< _Map >::Key_const_iterator make_map_key_lower_bound(const _Map &map_r, const typename _Map::key_type &key_r)
Convenience to create the key iterator from container::lower_bound()
transform_iterator< GetPairFirst< typename MapType::value_type >, typename MapType::const_iterator > Key_const_iterator
The key iterator type.
An iterator over the subset of elements of some sequence which satisfy a given predicate.
filter_iterator< _Filter, typename _Container::const_iterator > make_filter_begin(_Filter f, const _Container &c)
Convenience to create filter_iterator from container::begin().
transform_iterator< GetPairSecond< typename MapType::value_type >, typename MapType::const_iterator > Value_const_iterator
The value iterator type.
Functor taking a std::pair returning std::pair.first.
const _Pair::first_type & operator()(const _Pair &pair_r) const
MapKVIteratorTraits< _Map >::Value_const_iterator make_map_value_begin(const _Map &map_r)
Convenience to create the value iterator from container::begin()
MapKVIteratorTraits< _Map >::Value_const_iterator make_map_value_lower_bound(const _Map &map_r, const typename _Map::key_type &key_r)
Convenience to create the value iterator from container::lower_bound()
_Map MapType
The map type.
MapKVIteratorTraits< _Map >::Key_const_iterator make_map_key_upper_bound(const _Map &map_r, const typename _Map::key_type &key_r)
Convenience to create the key iterator from container::upper_bound()
MapKVIteratorTraits< _Map >::Key_const_iterator make_map_key_begin(const _Map &map_r)
Convenience to create the key iterator from container::begin()
_Map::mapped_type ValueType
The maps value (mapped) type.
const _Pair::second_type & operator()(const _Pair &pair_r) const
_Map::key_type KeyType
The maps key type.
MapKVIteratorTraits< _Map >::Value_const_iterator make_map_value_upper_bound(const _Map &map_r, const typename _Map::key_type &key_r)
Convenience to create the value iterator from container::upper_bound()
filter_iterator< _Filter, typename _Container::const_iterator > make_filter_end(_Filter f, const _Container &c)
Convenience to create filter_iterator from container::end().
MapKVIteratorTraits< _Map >::Key_const_iterator make_map_key_end(const _Map &map_r)
Convenience to create the key iterator from container::end()
Traits for std::map key and value iterators.