File indexing completed on 2025-07-05 08:26:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/EventData/detail/DynamicColumn.hpp"
0012 #include "Acts/Utilities/HashedString.hpp"
0013
0014 #include <unordered_map>
0015
0016 namespace Acts::detail {
0017
0018 template <typename C>
0019 class DynamicKeyIterator {
0020 using map_t = std::unordered_map<HashedString, std::unique_ptr<C>>;
0021
0022 public:
0023 using iterator_category = std::forward_iterator_tag;
0024 using value_type = HashedString;
0025 using difference_type = std::ptrdiff_t;
0026 using pointer = void;
0027 using reference = void;
0028
0029 DynamicKeyIterator(typename map_t::const_iterator it) : m_it{it} {}
0030 DynamicKeyIterator() = default;
0031
0032 DynamicKeyIterator& operator++() {
0033 m_it++;
0034 return *this;
0035 }
0036
0037 DynamicKeyIterator operator++(int ) {
0038 auto copy = *this;
0039 ++(copy.m_it);
0040 return copy;
0041 }
0042
0043 bool operator==(const DynamicKeyIterator& other) const {
0044 return m_it == other.m_it;
0045 }
0046
0047 bool operator!=(const DynamicKeyIterator& other) const {
0048 return m_it != other.m_it;
0049 }
0050
0051 value_type operator*() const { return m_it->first; }
0052
0053 private:
0054 typename map_t::const_iterator m_it;
0055 };
0056
0057 static_assert(std::forward_iterator<DynamicKeyIterator<int>>,
0058 "DynamicKeyIterator<int> does not fulfill std::forward_iterator");
0059
0060 template <typename C>
0061 class DynamicKeyRange {
0062 public:
0063 DynamicKeyRange(DynamicKeyIterator<C> begin, DynamicKeyIterator<C> end)
0064 : m_begin{begin}, m_end{end} {}
0065
0066 DynamicKeyIterator<C> begin() const { return m_begin; }
0067 DynamicKeyIterator<C> end() const { return m_end; }
0068
0069 private:
0070 DynamicKeyIterator<C> m_begin;
0071 DynamicKeyIterator<C> m_end;
0072 };
0073
0074 }