ATLAS Offline Software
Loading...
Searching...
No Matches
ProductItr.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCOMPOSITEUTILS_PRODUCTITR_H
6#define TRIGCOMPOSITEUTILS_PRODUCTITR_H
7
8#include <functional>
9#include <iterator>
10#include <type_traits>
11#include <vector>
12
13namespace TrigCompositeUtils {
42 template <typename Iterator>
43 class ProductItr {
44 public:
46 using iterator_category = std::input_iterator_tag;
47 using value_type = std::vector<Iterator>;
48 using reference = const value_type &;
49 using pointer = const value_type *;
50 using difference_type = std::ptrdiff_t;
51
53 ProductItr() = default;
54
61 ProductItr(const std::vector<Iterator> &itrs, const std::vector<Iterator> &endItrs);
62
64 std::size_t nItrs() const { return m_startItrs.size(); }
65
67 void reset();
68
70 bool exhausted() const;
71
75
78
81
83 bool operator==(const ProductItr &other) const;
84 bool operator!=(const ProductItr &other) const;
85
86 private:
87 std::vector<Iterator> m_startItrs;
88 std::vector<Iterator> m_endItrs;
89 std::vector<Iterator> m_currentItrs;
90
91 }; //> end class ProductItr<Iterator>
92} // namespace TrigCompositeUtils
93
95
96#endif //> !TRIGCOMPOSITEUTILS_PRODUCT_ITR_H
ProductItr operator++(int)
Post-increment operator.
void reset()
Helper function to reset this iterator to its start position.
const value_type * pointer
Definition ProductItr.h:49
ProductItr(const std::vector< Iterator > &itrs, const std::vector< Iterator > &endItrs)
Construct the iterator from an input vector of iterators.
bool exhausted() const
True if this iterator is past the end.
std::vector< Iterator > m_currentItrs
Definition ProductItr.h:89
ProductItr()=default
Default constructor creates a generic past-the-end iterator.
bool operator==(const ProductItr &other) const
Iterator comparison functions.
const value_type & reference
Definition ProductItr.h:48
std::vector< Iterator > value_type
Definition ProductItr.h:47
std::vector< Iterator > m_startItrs
Definition ProductItr.h:87
std::size_t nItrs() const
The number of input iterators.
Definition ProductItr.h:64
bool operator!=(const ProductItr &other) const
ProductItr & operator++()
Pre-increment operator.
reference operator*() const
Dereference.
std::vector< Iterator > m_endItrs
Definition ProductItr.h:88
std::input_iterator_tag iterator_category
Iterator traits.
Definition ProductItr.h:46