26 #ifndef LARCORE_COREUTILS_DEREFERENCEITERATOR_H 27 #define LARCORE_COREUTILS_DEREFERENCEITERATOR_H 31 #include <type_traits> 39 template <
typename BeginIter,
typename EndIter>
47 BeginIter
const&
begin()
const {
return b; }
48 EndIter
const&
end()
const {
return e; }
52 template <
typename BeginIter,
typename EndIter>
59 template <
typename Iter,
typename Value>
75 using pointer = std::add_pointer_t<value_type>;
76 using reference = std::add_lvalue_reference_t<value_type>;
91 : iter(
std::move(iter)) {}
96 template <
typename OtherIter,
typename OtherValue>
102 "Copying from a iterator with incompatible value" 109 template <
typename OtherIter,
typename OtherValue>
112 : iter(std::move(other.
iter))
115 "Moving from a iterator with incompatible value" 144 {
return { iter + offset }; }
146 {
return { iter - offset }; }
149 { iter += offset;
return *
this; }
151 { iter -= offset;
return *
this; }
157 {
return iter - other.
iter; }
166 {
return other.
iter == iter; }
168 {
return other.
iter != iter; }
170 {
return other.
iter <= iter; }
172 {
return other.
iter >= iter; }
174 {
return other.
iter < iter; }
176 {
return other.
iter < iter; }
183 template <
typename Iter,
typename Value>
188 {
return iter + offset; }
210 template <
typename Iter>
213 std::add_const_t<std::decay_t<decltype(**(std::declval<Iter>()))>>
224 template <
typename Iter>
227 std::decay_t<decltype(**(std::declval<Iter>()))>
245 template <
typename Iter>
259 template <
typename Cont>
273 template <
typename Cont>
287 template <
typename Cont>
301 template <
typename Cont>
330 template <
typename Cont>
366 template <
typename Cont>
380 template <
typename Iter>
385 template <
typename Cont>
390 template <
typename Cont>
395 template <
typename Cont>
400 template <
typename Cont>
426 template <
typename Cont>
462 template <
typename Cont>
475 #endif // LARCORE_COREUTILS_DEREFERENCEITERATOR_H typename iterator_t::difference_type difference_type
auto operator+(typename DereferenceIteratorBase< Iter, Value >::difference_type offset, DereferenceIteratorBase< Iter, Value > const &iter)
Swapped addition operator.
auto crbeginDereferenceIterator(Cont &cont)
Namespace for general, non-LArSoft-specific utilities.
auto crendDereferenceIterator(Cont &cont)
DereferenceIteratorBase(Iter const &iter, initialize_tag)
Constructor: copies the specified iterator in.
bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
iterator_t iter
wrapper iterator
constexpr bool operator>(Index_t left, Flag_t< Storage > right)
constexpr bool operator<=(Index_t left, Flag_t< Storage > right)
BeginIter const & begin() const
auto dereferenceConstIteratorLoop(Cont &cont)
Returns an object enabling a dereferencing range-for loop.
auto dereferenceIteratorLoop(Cont &cont)
Returns an object enabling a dereferencing range-for loop.
EndIter const & end() const
auto rendDereferenceIterator(Cont &cont)
Returns a dereference reverse iterator to the end of container.
auto dereferenceIteratorReverseLoop(Cont &cont)
Returns an object enabling a dereferencing reverse range-for loop.
auto beginDereferenceIterator(Cont &cont)
Returns a dereference iterator to the begin of specified container.
this_t & operator++()
Prefix increment operator.
Base class for dereferencing iterators.
auto makeIteratorBox(BeginIter b, EndIter e)
constexpr bool operator>=(Index_t left, Flag_t< Storage > right)
QuadExpr operator-(double v, const QuadExpr &e)
std::add_lvalue_reference_t< value_type > reference
std::add_pointer_t< value_type > pointer
auto makeDereferenceConstIterator(Iter &&iter)
this_t & operator--()
Prefix decrement operator.
auto makeDereferenceIterator(Iter &&iter)
Returns a dereference iterator to the begin of specified container.
String & operator+=(String &s, VectorDumper< Vector > const &manip)
Appends a string rendering of a vector to the specified string.
Iter iterator_t
wrapped iterator type
typename iterator_t::iterator_category iterator_category
bool is_null() const
Bonus: returns true if the pointer is not dereferentiable.
auto dereferenceConstIteratorReverseLoop(Cont &cont)
Returns an object enabling a dereferencing reverse range-for loop.
bool operator!=(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to different IDs.
std::string value(boost::any const &)
auto rbeginDereferenceIterator(Cont &cont)
Returns a dereference reverse iterator to the begin of container.
this_t operator--(int)
Postfix decrement operator.
DereferenceIteratorBase(Iter &&iter, initialize_tag)
Constructor: acquires the specified iterator.
LArSoft-specific namespace.
auto cendDereferenceIterator(Cont &cont)
Tag used for initialization.
auto cbeginDereferenceIterator(Cont &cont)
QuadExpr operator*(double v, const QuadExpr &e)
this_t operator++(int)
Postfix increment operator.
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
auto endDereferenceIterator(Cont &cont)
Returns a dereference iterator to the end of specified container.
IteratorBox(BeginIter b, EndIter e)