Go to the documentation of this file.
12 #define GAUDI_RANGE_H 1
54 template <
class CONTAINER>
59 using Iterator =
typename CONTAINER::const_iterator;
129 template <
typename InputIterator>
130 Range_( InputIterator first, InputIterator last ) :
m_base( first, last ) {}
170 if (
empty() || index1 == index2 ) {
return Range_(); }
172 if ( index1 < 0 ) { index1 +=
size(); }
173 if ( index2 < 0 ) { index2 +=
size(); }
175 if ( index1 < 0 ) {
return Range_(); }
176 if ( index2 < index1 ) {
return Range_(); }
178 if ( index1 > (
long)
size() ) {
return Range_(); }
179 if ( index2 > (
long)
size() ) { index2 =
size(); }
202 return ( *
this )(
index );
208 template <
class C,
class I>
213 template <
class ANOTHERCONTAINER>
222 if ( &right ==
this ) {
return true; }
226 template <
class ANOTHERCONTAINER>
236 explicit operator bool()
const {
return !
empty(); }
279 template <
class CONTAINER>
288 #endif // GAUDI_RANGE_H
Range_(const Container &cont)
constructor from the container
bool operator!() const
empty sequence?
const_reference operator()(const size_t index) const
non-checked access to the elements by index (valid only for non-empty sequences)
Gaudi::details::container< CONTAINER >::Container Container
type for actual contained iterator
constexpr auto size(const T &, Args &&...) noexcept
iter_traits::reference const_reference
helper structure to get container type
bool operator==(const ANOTHERCONTAINER &right) const
compare with another container
bool empty() const
empty sequence ?
const Base & base() const
conversion operator to the std::pair
reverse_iterator rend() const
access to begin of the reversed sequence (const)
GAUDI_API void rangeException(const long index, const size_t size)
Helpful function to throw an "out-of-range exception" for class Range_.
Gaudi::cpp17::detected_or_t< CONTAINER, _has_container_t, CONTAINER > Container
const_reference at(const long index) const
Checked access to the elements by index (valid for all sequences)
typename T::Container _has_container_t
Range_(InputIterator first, InputIterator last)
Constructor.
~Range_()=default
destructor
reverse_iterator rbegin() const
access to begin of the reversed sequence (const)
const_reference operator[](const long index) const
non-checked access to the elements by index (valid only for non-empty sequences)
iterator begin() const
access to begin of the sequence (const version )
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
iterator cend() const
access to end of the sequence (const version)
size_t size() const
size of the sequence (number of elements)
std::pair< ITERATOR, ITERATOR > Base
typename details::detector< Default, void, Op, Args... >::type detected_or_t
T lexicographical_compare(T... args)
typename CONTAINER::const_iterator Iterator
std::reverse_iterator< iterator > const_reverse_iterator
Base m_base
the base itself
iter_traits::reference reference
bool operator<(const Range_< C, I > &right) const
compare with another range
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Range_()=default
internal types
std::reverse_iterator< iterator > reverse_iterator
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
Generator[dict, None, None] reference(request, Optional[Path] reference_path)
iter_traits::value_type value_type
Range_(const Base &base)
constructor from the pair of iterators
std::iterator_traits< iterator > iter_traits
bool operator==(const Range_ &right) const
equality with another range
bool operator<(const ANOTHERCONTAINER &right) const
compare with another container
iterator cbegin() const
access to begin of the sequence (const version )
iterator end() const
access to end of the sequence (const version)
const_reference front() const
access for the first element (only for non-empty ranges!)
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator