ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
CxxUtils::releasing_iterator< ITERATOR > Class Template Reference

Adapter to retrieve elements from a unique_ptr iterator via release(). More...

#include <releasing_iterator.h>

Collaboration diagram for CxxUtils::releasing_iterator< ITERATOR >:

Public Types

using value_type = typename std::iterator_traits< ITERATOR >::value_type::pointer
 
using reference = value_type &
 
using pointer = value_type *
 
using difference_type = typename std::iterator_traits< ITERATOR >::difference_type
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 releasing_iterator (ITERATOR it)
 
value_type operator* ()
 
releasing_iteratoroperator++ ()
 
bool operator!= (const releasing_iterator &other) const
 

Private Attributes

ITERATOR m_it
 

Detailed Description

template<class ITERATOR>
class CxxUtils::releasing_iterator< ITERATOR >

Adapter to retrieve elements from a unique_ptr iterator via release().

This allows, say,

std::vector<std::unique_ptr<Foo> > c1 = ...;
std::vector<Foo*> c2;
c2.assign (releasing_iterator(c1.begin()), releasing_iterator(c1.end()));

All elements in c1 will be release'd.

Since this implies that a given iterator can only be dereferenced once, this iterator models input_iterator.

Definition at line 39 of file releasing_iterator.h.

Member Typedef Documentation

◆ difference_type

template<class ITERATOR >
using CxxUtils::releasing_iterator< ITERATOR >::difference_type = typename std::iterator_traits<ITERATOR>::difference_type

Definition at line 45 of file releasing_iterator.h.

◆ iterator_category

template<class ITERATOR >
using CxxUtils::releasing_iterator< ITERATOR >::iterator_category = std::input_iterator_tag

Definition at line 46 of file releasing_iterator.h.

◆ pointer

template<class ITERATOR >
using CxxUtils::releasing_iterator< ITERATOR >::pointer = value_type*

Definition at line 44 of file releasing_iterator.h.

◆ reference

template<class ITERATOR >
using CxxUtils::releasing_iterator< ITERATOR >::reference = value_type&

Definition at line 43 of file releasing_iterator.h.

◆ value_type

template<class ITERATOR >
using CxxUtils::releasing_iterator< ITERATOR >::value_type = typename std::iterator_traits<ITERATOR>::value_type::pointer

Definition at line 42 of file releasing_iterator.h.

Constructor & Destructor Documentation

◆ releasing_iterator()

template<class ITERATOR >
CxxUtils::releasing_iterator< ITERATOR >::releasing_iterator ( ITERATOR  it)
inline

Definition at line 48 of file releasing_iterator.h.

48 : m_it (it) {}

Member Function Documentation

◆ operator!=()

template<class ITERATOR >
bool CxxUtils::releasing_iterator< ITERATOR >::operator!= ( const releasing_iterator< ITERATOR > &  other) const
inline

Definition at line 51 of file releasing_iterator.h.

51 { return m_it != other.m_it; }

◆ operator*()

template<class ITERATOR >
value_type CxxUtils::releasing_iterator< ITERATOR >::operator* ( )
inline

Definition at line 49 of file releasing_iterator.h.

49 { return m_it->release(); }

◆ operator++()

template<class ITERATOR >
releasing_iterator& CxxUtils::releasing_iterator< ITERATOR >::operator++ ( )
inline

Definition at line 50 of file releasing_iterator.h.

50 { ++m_it; return *this; }

Member Data Documentation

◆ m_it

template<class ITERATOR >
ITERATOR CxxUtils::releasing_iterator< ITERATOR >::m_it
private

Definition at line 55 of file releasing_iterator.h.


The documentation for this class was generated from the following file:
extractSporadic.c1
c1
Definition: extractSporadic.py:134
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CxxUtils::releasing_iterator::releasing_iterator
releasing_iterator(ITERATOR it)
Definition: releasing_iterator.h:48
CxxUtils::releasing_iterator::m_it
ITERATOR m_it
Definition: releasing_iterator.h:55
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16