2 #define GAUDI_RANGE_H 1 48 template <
typename T1>
49 static typename T1::Container
test(
int );
51 static void test( ... );
56 template <
class CONTAINER,
bool>
58 template <
class CONTAINER>
62 template <
class CONTAINER>
68 template <
class CONTAINER>
72 typedef typename CONTAINER::const_iterator
Iterator;
144 Range_( iterator ibegin, iterator iend ) : m_base( ibegin, iend ) {}
148 Range_(
const Base& base ) : m_base( base ) {}
156 Range_( iterator ibegin ) : m_base( ibegin, ibegin ) {}
161 bool empty()
const {
return m_base.second == m_base.first; }
165 iterator
begin()
const {
return m_base.first; }
167 iterator
end()
const {
return m_base.second; }
169 iterator
cbegin()
const {
return m_base.first; }
171 iterator
cend()
const {
return m_base.second; }
173 reverse_iterator
rbegin()
const {
return reverse_iterator(
end() ); }
175 reverse_iterator
rend()
const {
return reverse_iterator(
begin() ); }
185 if ( empty() || index1 == index2 ) {
199 if ( index2 < index1 ) {
203 if ( index1 > (
long)size() ) {
206 if ( index2 > (
long)size() ) {
223 inline const_reference
operator[](
const long index )
const {
return ( *
this )( index ); }
229 inline const_reference
at(
const long index )
const 231 if ( index < 0 || index >= (
long)size() ) {
234 return ( *
this )( index );
240 template <
class C,
class I>
241 bool operator<( const Range_<C, I>& right )
const 246 template <
class ANOTHERCONTAINER>
257 if ( &right ==
this ) {
263 template <
class CNT,
class IT>
269 template <
class ANOTHERCONTAINER>
280 explicit operator bool()
const {
return !empty(); }
285 operator const Base&()
const {
return base(); }
287 inline const Base&
base()
const {
return m_base; }
323 template <
class CONTAINER>
333 #endif // GAUDI_RANGE_H details::_container< CONTAINER, details::_has_typename_container_< CONTAINER >::value >::Container Container
bool empty() const
empty sequence ?
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_.
iterator cbegin() const
access to begin of the sequence (const version )
iter_traits::value_type value_type
std::reverse_iterator< iterator > reverse_iterator
helper structure to get container type
std::iterator_traits< iterator > iter_traits
Range_ slice(long index1, long index2) const
get a "slice" of a range, in Python style
helper class to simplify the dealing with ranges in Python
CONTAINER::Container Container
reverse_iterator rbegin() const
access to begin of the reversed sequence (const)
iter_traits::reference reference
bool operator==(const Range_< CNT, IT > &right) const
equality with another range type
const_reference front() const
access for the first element (only for non-empty ranges!)
auto begin(reverse_wrapper< T > &w)
bool operator!() const
empty sequence?
Range_(iterator ibegin, iterator iend)
Constructor.
iter_traits::reference const_reference
const_reference operator[](const long index) const
non-checked access to the elements by index (valid only for non-empty sequences)
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range from arbitrary container
Gaudi::details::container< CONTAINER >::Container Container
type for actual contained iterator
const_reference at(const long index) const
Checked access to the elements by index (valid for all sequences) for out-of-range access...
auto end(reverse_wrapper< T > &w)
Range_(const Base &base)
constructor from the pair of iterators
T lexicographical_compare(T...args)
bool operator==(const Range_ &right) const
equality with another range
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
iterator end() const
access to end of the sequence (const version)
const Base & base() const
conversion operator to the std::pair
iterator cend() const
access to end of the sequence (const version)
bool operator==(const ANOTHERCONTAINER &right) const
compare with another container
bool operator<(const ANOTHERCONTAINER &right) const
compare with another container
Useful class for representation of "sequence" of the objects through the range of valid iterators...
size_t size() const
size of the sequence (number of elements)
CONTAINER::const_iterator Iterator
reverse_iterator rend() const
access to begin of the reversed sequence (const)
const_reference operator()(const size_t index) const
non-checked access to the elements by index (valid only for non-empty sequences)
const_reference back() const
access for the back element (only for non-empty ranges!)
Range_(const Container &cont)
constructor from the container
Helper functions to set/get the application return code.
TO * reference(FROM *from)
iterator begin() const
access to begin of the sequence (const version )
static T1::Container test(int)