Public Types | Public Member Functions | Protected Attributes | List of all members
rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map > Class Template Reference

Provides iterators for std::begin() and std::end() More...

#include <MapKeyIterator.h>

Public Types

using map_t = Map
 
using const_iterator = MapKeyIterator< typename map_t::const_iterator >
 

Public Member Functions

 MapKeyConstIteratorBox (map_t const &map)
 
const_iterator begin ()
 
const_iterator end ()
 
const_iterator cbegin ()
 
const_iterator cend ()
 

Protected Attributes

const_iterator beginKey
 iterator pointing to the begin key More...
 
const_iterator endKey
 iterator pointing to the endkey More...
 

Detailed Description

template<typename Map>
class rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >

Provides iterators for std::begin() and std::end()

Template Parameters
Maptype of the map to be wrapped

This object can wrap a map-like type to iterate through its key in a range-based for loop.

Example of usage:

std::map<int, double> my_map;
// ... fill the map ...
// print all the kets
for (int const& key: MapKeyConstIteratorBox<std::map<int, double>>(my_map))
  std::cout << "Key: " << key << std::endl;

Only constant iteration on keys is provided.

Definition at line 104 of file MapKeyIterator.h.

Member Typedef Documentation

template<typename Map >
using rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::const_iterator = MapKeyIterator<typename map_t::const_iterator>

Definition at line 108 of file MapKeyIterator.h.

Definition at line 106 of file MapKeyIterator.h.

Constructor & Destructor Documentation

template<typename Map >
rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::MapKeyConstIteratorBox ( map_t const &  map)
inline

Definition at line 110 of file MapKeyIterator.h.

110  :
111  beginKey(map.cbegin()), endKey(map.cend())
112  {}
const_iterator beginKey
iterator pointing to the begin key
const_iterator endKey
iterator pointing to the endkey

Member Function Documentation

template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::begin ( )
inline

Definition at line 114 of file MapKeyIterator.h.

114 { return beginKey; }
const_iterator beginKey
iterator pointing to the begin key
template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::cbegin ( )
inline

Definition at line 116 of file MapKeyIterator.h.

116 { return beginKey; }
const_iterator beginKey
iterator pointing to the begin key
template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::cend ( )
inline

Definition at line 117 of file MapKeyIterator.h.

117 { return endKey; }
const_iterator endKey
iterator pointing to the endkey
template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::end ( void  )
inline

Definition at line 115 of file MapKeyIterator.h.

115 { return endKey; }
const_iterator endKey
iterator pointing to the endkey

Member Data Documentation

template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::beginKey
protected

iterator pointing to the begin key

Definition at line 120 of file MapKeyIterator.h.

template<typename Map >
const_iterator rndm::NuRandomServiceHelper::MapKeyConstIteratorBox< Map >::endKey
protected

iterator pointing to the endkey

Definition at line 121 of file MapKeyIterator.h.


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