11 #ifndef NESTEDITERATOR_H 12 #define NESTEDITERATOR_H 15 #include <type_traits> 21 namespace type_traits {
25 template <
typename T,
bool>
42 <T, details::type_traits::has_const_iterator_helper((T*)(nullptr))>
83 template <
typename CITER,
typename INNERCONTEXTRACT>
95 namespace type_traits {
99 template <
typename T,
bool>
100 struct has_const_iterator_struct:
public std::false_type {};
102 template <
typename T>
107 template <
typename T>
128 result_type& operator() (argument_type&
x)
const {
return x; }
129 const result_type& operator() (
const argument_type&
x)
const {
return x; }
142 result_type& operator() (argument_type& p)
const 144 const result_type& operator() (
const argument_type& p)
const 152 template <
typename ITER,
typename INNERCONTEXTRACT>
211 template <
class CONT>
232 template <
class CONT>
253 {
iterator_type old(*
this); this->operator++();
return old; }
283 operator bool()
const {
return !is_end(); }
306 bool is_end()
const {
return outer_iter == outer_end; }
309 const typename InnerContainerExtractor_t::result_type&
311 {
return InnerContainerExtractor_t()(v); }
320 template <
typename ITER,
typename INNERCONTEXTRACT>
324 outer_iter(src), outer_end(end)
326 if (is_end())
return;
332 template <
typename ITER,
typename INNERCONTEXTRACT>
341 template <
typename ITER,
typename INNERCONTEXTRACT>
352 template <
typename ITER,
typename INNERCONTEXTRACT>
354 inner_iter =
std::begin(extract_container(*outer_iter));
355 inner_end =
std::end(extract_container(*outer_iter));
359 template <
typename ITER,
typename INNERCONTEXTRACT>
361 { inner_end = inner_iter = {}; }
363 template <
typename ITER,
typename INNERCONTEXTRACT>
365 while(inner_iter == inner_end) {
380 template <
typename CITER,
typename INNERCONTEXTRACT>
390 #endif // NESTEDITERATOR_H
deep_const_fwd_iterator_nested(const CONT &cont, EndPositionTag)
Constructor: starts from the end of the specified container.
typename InnerIterator_t::value_type value_type
Type of the value pointed by the iterator.
InnerIterator_t inner_iter
points to the current element
typename InnerContainer_t::const_iterator InnerIterator_t
const InnerContainerExtractor_t::result_type & extract_container(const typename OuterIterator_t::value_type &v)
Extracts the value out of the inner iterator.
INNERCONTEXTRACT InnerContainerExtractor_t
iterator_type operator++(int)
Postfix increment operator: points to the next element.
InnerIterator_t inner_end
stores the end of current inner container
OuterIterator_t outer_iter
points to current inner container
deep_const_fwd_iterator_nested(OuterIterator_t end)
Internal constructor: past-the-end iterator pointing to specified place.
iterator_type & operator++()
Prefix increment operator: points to the next element.
const value_type & operator*() const
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
void swap(iterator_type &with)
Swaps this with the specified iterator.
Functor returning the object specified as argument.
constexpr auto has_const_iterator_helper(T *=nullptr) -> decltype(typename T::const_iterator(), bool())
bool operator!=(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to different IDs.
LArSoft-specific namespace.
OuterIterator_t outer_end
points to past-the-end inner container
Internal helper class: actual implementation of nested iterator.
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
deep_const_fwd_iterator_nested(const CONT &cont, BeginPositionTag)
Constructor: starts from the beginning of the specified container.
const value_type & operator->() const
typename InnerContainerExtractor_t::result_type InnerContainer_t
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
T::second_type result_type
std::enable_if_t< std::is_base_of< art::SelectorBase, A >::value, art::NotHelper< A > > operator!(A const &a)
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
void skip_empty()
points to the next item