11 #ifndef NESTEDITERATOR_H 12 #define NESTEDITERATOR_H 16 #include <type_traits> 21 namespace type_traits {
25 template <
typename T,
bool>
42 details::type_traits::has_const_iterator_helper((T*)(nullptr))> {};
52 template <
typename ITER,
typename INNERCONTEXTRACT = Identity<
typename ITER::value_type>>
65 template <
typename CITER,
typename INNERCONTEXTRACT = Identity<
typename CITER::value_type>>
71 template <
typename CITER,
typename INNERCONTEXTRACT>
82 namespace type_traits {
86 template <
typename T,
bool>
87 struct has_const_iterator_struct :
public std::false_type {};
121 const result_type&
operator()(
const argument_type&
x)
const {
return x; }
133 result_type&
operator()(argument_type& p)
const {
return p.second; }
134 const result_type&
operator()(
const argument_type& p)
const {
return p.second; }
140 template <
typename ITER,
typename INNERCONTEXTRACT>
198 template <
class CONT>
221 template <
class CONT>
276 operator bool()
const {
return !is_end(); }
299 bool is_end()
const {
return outer_iter == outer_end; }
303 const typename OuterIterator_t::value_type& v)
314 template <
typename ITER,
typename INNERCONTEXTRACT>
318 : outer_iter(src), outer_end(end)
325 template <
typename ITER,
typename INNERCONTEXTRACT>
334 template <
typename ITER,
typename INNERCONTEXTRACT>
343 template <
typename ITER,
typename INNERCONTEXTRACT>
350 template <
typename ITER,
typename INNERCONTEXTRACT>
356 template <
typename ITER,
typename INNERCONTEXTRACT>
372 template <
typename CITER,
typename INNERCONTEXTRACT>
380 #endif // NESTEDITERATOR_H
deep_const_fwd_iterator_nested(const CONT &cont, EndPositionTag)
Constructor: starts from the end of the specified container.
deep_const_fwd_iterator_nested()=default
Default constructor: invalid iterator.
typename InnerIterator_t::value_type value_type
Type of the value pointed by the iterator.
InnerIterator_t inner_iter
points to the current element
result_type & operator()(argument_type &x) const
bool operator!() const
Bonus: convert to bool to find out if we are at the end.
result_type & operator()(argument_type &p) const
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
const result_type & operator()(const argument_type &x) const
iterator_type operator++(int)
Postfix increment operator: points to the next element.
const result_type & operator()(const argument_type &p) const
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.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
iterator_type & operator++()
Prefix increment operator: points to the next element.
const value_type & operator*() const
bool operator!=(const iterator_type &as) const
Returns true if the two iterators are not equivalent.
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==(const iterator_type &as) const
Returns true if the two iterators are not equivalent.
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
void skip_empty()
points to the next item