2 #define GAUDI_RANGE_H 1 45 template <
class CONTAINER>
49 using Container = Gaudi::cpp17::detected_or_t<CONTAINER, _has_container_t, CONTAINER>;
50 using Iterator =
typename CONTAINER::const_iterator;
120 template <
typename InputIterator>
121 Range_( InputIterator first, InputIterator last ) :
m_base( first, last ) {}
161 if (
empty() || index1 == index2 ) {
return Range_(); }
163 if ( index1 < 0 ) { index1 +=
size(); }
164 if ( index2 < 0 ) { index2 +=
size(); }
166 if ( index1 < 0 ) {
return Range_(); }
167 if ( index2 < index1 ) {
return Range_(); }
169 if ( index1 > (
long)
size() ) {
return Range_(); }
170 if ( index2 > (
long)
size() ) { index2 =
size(); }
193 return ( *
this )( index );
199 template <
class C,
class I>
204 template <
class ANOTHERCONTAINER>
213 if ( &right ==
this ) {
return true; }
217 template <
class CNT,
class IT>
222 template <
class ANOTHERCONTAINER>
232 explicit operator bool()
const {
return !
empty(); }
275 template <
class CONTAINER>
284 #endif // GAUDI_RANGE_H constexpr auto size(const T &, Args &&...) noexcept
iterator cend() const
access to end of the sequence (const version)
std::pair< ITERATOR, ITERATOR > Base
std::reverse_iterator< iterator > const_reverse_iterator
Base m_base
the base itself
GAUDI_API void rangeException(const long index, const size_t size)
Helpful function to throw an "out-of-range exception" for class Range_.
bool operator<(const ANOTHERCONTAINER &right) const
compare with another container
bool operator==(const Range_< CNT, IT > &right) const
equality with another range type
const_reference operator()(const size_t index) const
non-checked access to the elements by index (valid only for non-empty sequences)
typename T::Container _has_container_t
iter_traits::value_type value_type
std::reverse_iterator< iterator > reverse_iterator
helper structure to get container type
std::iterator_traits< iterator > iter_traits
helper class to simplify the dealing with ranges in Python
const_reference at(const long index) const
Checked access to the elements by index (valid for all sequences)
iter_traits::reference reference
bool operator!() const
empty sequence?
bool operator<(const Range_< C, I > &right) const
compare with another range
const Base & base() const
conversion operator to the std::pair
const_reference operator[](const long index) const
non-checked access to the elements by index (valid only for non-empty sequences)
iter_traits::reference const_reference
iterator end() const
access to end of the sequence (const version)
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
Range_(InputIterator first, InputIterator last)
Constructor.
reverse_iterator rend() const
access to begin of the reversed sequence (const)
Gaudi::details::container< CONTAINER >::Container Container
type for actual contained iterator
Range_()=default
internal types
bool operator==(const Range_ &right) const
equality with another range
bool operator==(const ANOTHERCONTAINER &right) const
compare with another container
const_reference back() const
access for the back element (only for non-empty ranges!)
Range_(const Base &base)
constructor from the pair of iterators
size_t size() const
size of the sequence (number of elements)
T lexicographical_compare(T... args)
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
const_reference front() const
access for the first element (only for non-empty ranges!)
typename CONTAINER::const_iterator Iterator
bool empty() const
empty sequence ?
Range_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
Useful class for representation of "sequence" of the objects through the range of valid iterators.
~Range_()=default
destructor
Range_(const Container &cont)
constructor from the container
iterator begin() const
access to begin of the sequence (const version )
Header file for std:chrono::duration-based Counters.
iterator cbegin() const
access to begin of the sequence (const version )
reverse_iterator rbegin() const
access to begin of the reversed sequence (const)
Gaudi::cpp17::detected_or_t< CONTAINER, _has_container_t, CONTAINER > Container