ATLAS Offline Software
releasing_iterator.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef CXXUTILS_RELEASING_ITERATOR_H
14 #define CXXUTILS_RELEASING_ITERATOR_H
15 
16 
17 #include <iterator>
18 
19 
20 namespace CxxUtils {
21 
22 
38 template <class ITERATOR>
40 {
41 public:
42  using value_type = typename std::iterator_traits<ITERATOR>::value_type::pointer;
44  using pointer = value_type*;
45  using difference_type = typename std::iterator_traits<ITERATOR>::difference_type;
46  using iterator_category = std::input_iterator_tag;
47 
48  releasing_iterator (ITERATOR it) : m_it (it) {}
49  value_type operator*() { return m_it->release(); }
50  releasing_iterator& operator++() { ++m_it; return *this; }
51  bool operator!= (const releasing_iterator& other) const { return m_it != other.m_it; }
52 
53 
54 private:
55  ITERATOR m_it;
56 };
57 
58 
59 } // namespace CxxUtils
60 
61 
62 #endif // not CXXUTILS_RELEASING_ITERATOR_H
CxxUtils::releasing_iterator::operator++
releasing_iterator & operator++()
Definition: releasing_iterator.h:50
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CxxUtils::releasing_iterator::operator!=
bool operator!=(const releasing_iterator &other) const
Definition: releasing_iterator.h:51
CxxUtils::releasing_iterator::releasing_iterator
releasing_iterator(ITERATOR it)
Definition: releasing_iterator.h:48
reference
Definition: hcg.cxx:437
CxxUtils::releasing_iterator
Adapter to retrieve elements from a unique_ptr iterator via release().
Definition: releasing_iterator.h:40
CxxUtils::releasing_iterator::iterator_category
std::input_iterator_tag iterator_category
Definition: releasing_iterator.h:46
CxxUtils::releasing_iterator::pointer
value_type * pointer
Definition: releasing_iterator.h:44
CxxUtils::releasing_iterator::m_it
ITERATOR m_it
Definition: releasing_iterator.h:55
CxxUtils
Definition: aligned_vector.h:29
CxxUtils::releasing_iterator::operator*
value_type operator*()
Definition: releasing_iterator.h:49
CxxUtils::releasing_iterator::difference_type
typename std::iterator_traits< ITERATOR >::difference_type difference_type
Definition: releasing_iterator.h:45
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
value_type
Definition: EDM_MasterSearch.h:11