43 template <
class CONTAINER>
80 template <
class CONTAINER>
88 using Base = std::pair<iterator, iterator>;
107 template <
typename InputIterator>
108 Range_( InputIterator first, InputIterator last ) :
m_base( first, last ) {}
148 if (
empty() || index1 == index2 ) {
return Range_(); }
150 if ( index1 < 0 ) { index1 +=
size(); }
151 if ( index2 < 0 ) { index2 +=
size(); }
153 if ( index1 < 0 ) {
return Range_(); }
154 if ( index2 < index1 ) {
return Range_(); }
156 if ( index1 > (
long)
size() ) {
return Range_(); }
157 if ( index2 > (
long)
size() ) { index2 =
size(); }
160 return Range_( std::next(
begin(), index1 ), std::next(
begin(), index2 ) );
180 return ( *
this )( index );
186 return std::lexicographical_compare(
begin(),
end(), right.
begin(), right.
end() );
189 template <
class ANOTHERCONTAINER>
191 return std::lexicographical_compare(
begin(),
end(), right.begin(), right.end() );
196 if ( &right ==
this ) {
return true; }
200 template <
class ANOTHERCONTAINER>
202 return right.size() ==
size() && std::equal(
begin(),
end(), right.begin() );
208 explicit operator bool()
const {
return !
empty(); }
246 template <
class CONTAINER>
Useful class for representation of "sequence" of the objects through the range of valid iterators.
std::reverse_iterator< iterator > const_reverse_iterator
iterator cbegin() const
access to begin of the sequence (const version )
Range_(const Base &base)
constructor from the pair of iterators
std::iterator_traits< iterator > iter_traits
Range_(const Container &cont)
constructor from the container
iter_traits::reference const_reference
Range_()=default
default constructor
bool operator==(const Range_ &right) const
equality with another range
const_reference operator()(const size_t index) const
non-checked access to the elements by index (valid only for non-empty sequences)
typename T::const_iterator const_iterator
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_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
size_t size() const
size of the sequence (number of elements)
typename Gaudi::details::container< T >::Container Container
reverse_iterator rend() const
access to begin of the reversed sequence (const)
const Base & base() const
iter_traits::reference reference
Range_(InputIterator first, InputIterator last)
Constructor.
bool operator==(const ANOTHERCONTAINER &right) const
compare with another container
iter_traits::value_type value_type
bool empty() const
empty sequence ?
bool operator!() const
empty sequence?
const_reference at(const long index) const
Checked access to the elements by index (valid for all sequences).
const_reference operator[](const long index) const
non-checked access to the elements by index (valid only for non-empty sequences)
std::reverse_iterator< iterator > reverse_iterator
std::pair< iterator, iterator > Base
bool operator<(const Range_< C > &right) const
compare with another range
reverse_iterator rbegin() const
access to begin of the reversed sequence (const)
const_reference front() const
access for the first element (only for non-empty ranges!)
iterator cend() const
access to end of the sequence (const version)
typename details::detector< Default, void, Op, Args... >::type detected_or_t
GAUDI_API void rangeException(const long index, const size_t size)
Helpful function to throw an "out-of-range exception" for class Range_.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
helper class to simplify the dealing with ranges in Python
helper structure to get container type
typename T::Container _has_container_t
Gaudi::cpp17::detected_or_t< CONTAINER, _has_container_t, CONTAINER > Container