libzypp  13.10.6
zypp::MapKVIteratorTraits< _Map > Struct Template Reference

Traits for std::map key and value iterators. More...

#include <Iterator.h>

Public Types

typedef _Map MapType
 The map type. More...
 
typedef _Map::key_type KeyType
 The maps key type. More...
 
typedef transform_iterator
< GetPairFirst< typename
MapType::value_type >
, typename
MapType::const_iterator > 
Key_const_iterator
 The key iterator type. More...
 
typedef _Map::mapped_type ValueType
 The maps value (mapped) type. More...
 
typedef transform_iterator
< GetPairSecond< typename
MapType::value_type >
, typename
MapType::const_iterator > 
Value_const_iterator
 The value iterator type. More...
 

Detailed Description

template<class _Map>
struct zypp::MapKVIteratorTraits< _Map >

Traits for std::map key and value iterators.

GetPairFirst and GetPairSecond help building a transform_iterator that iterates over keys or values of a std::map. Class MapKVIteratorTraits provides some typedefs, you usg. do not want to write explicitly.

* // typedefs
* typedef std::map<K,V> MapType;
*
* // transform_iterator<GetPairFirst<MapType::value_type>, MapType::const_iterator>
* typedef MapKVIteratorTraits<MapType>::Key_const_iterator MapTypeKey_iterator;
* // transform_iterator<GetPairSecond<MapType::value_type>, MapType::const_iterator>
* typedef MapKVIteratorTraits<MapType>::Value_const_iterator MapTypeValue_iterator;
*
* // usage
* MapType mymap;
*
* MapTypeKey_const_iterator keyBegin( make_map_key_begin( mymap ) );
* MapTypeKey_const_iterator keyEnd ( make_map_key_end( mymap ) );
*
* MapTypeValue_const_iterator valBegin( make_map_value_begin( mymap ) );
* MapTypeValue_const_iterator valEnd ( make_map_value_end( mymap ) );
*
* std::for_each( keyBegin, keyEnd, DoSomething() );
* std::for_each( valBegin, valEnd, DoSomething() );
*

Or short:

* typedef std::map<K,V> MapType;
* MapType mymap;
*
* std::for_each( make_map_key_begin( mymap ), make_map_key_end( mymap ), DoSomething() );
* std::for_each( make_map_value_begin( mymap ), make_map_value_end( mymap ), DoSomething() );
*

Definition at line 208 of file Iterator.h.

Member Typedef Documentation

template<class _Map>
typedef _Map zypp::MapKVIteratorTraits< _Map >::MapType

The map type.

Definition at line 211 of file Iterator.h.

template<class _Map>
typedef _Map::key_type zypp::MapKVIteratorTraits< _Map >::KeyType

The maps key type.

Definition at line 213 of file Iterator.h.

template<class _Map>
typedef transform_iterator<GetPairFirst<typename MapType::value_type>, typename MapType::const_iterator> zypp::MapKVIteratorTraits< _Map >::Key_const_iterator

The key iterator type.

Definition at line 216 of file Iterator.h.

template<class _Map>
typedef _Map::mapped_type zypp::MapKVIteratorTraits< _Map >::ValueType

The maps value (mapped) type.

Definition at line 218 of file Iterator.h.

template<class _Map>
typedef transform_iterator<GetPairSecond<typename MapType::value_type>, typename MapType::const_iterator> zypp::MapKVIteratorTraits< _Map >::Value_const_iterator

The value iterator type.

Definition at line 221 of file Iterator.h.


The documentation for this struct was generated from the following file: