11 #ifndef NESTEDITERATOR_H 12 #define NESTEDITERATOR_H 15 #include <type_traits> 25 template <
typename T,
bool>
42 <T, details::type_traits::has_const_iterator_helper((T*)(nullptr))>
83 template <
typename CITER,
typename INNERCONTEXTRACT>
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.
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
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
std::enable_if_t< is_selector< A >, NotHelper< A > > operator!(A const &a)
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
bool operator!=(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
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.
static constexpr double as
const value_type & operator*() const
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())
LArSoft-specific namespace.
OuterIterator_t outer_end
points to past-the-end inner container
Internal helper class: actual implementation of nested iterator.
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
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
T::second_type result_type
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
void skip_empty()
points to the next item