A pair of iterators usable with the range base for loop.
More...
#include <SortedRange.h>
|
using | Iterator = AIterator |
| Iterator type of the range.
|
|
using | Reference = typename std::iterator_traits<AIterator>::reference |
| The type the iterator references.
|
|
using | iterator = Iterator |
| Iterator definition for stl.
|
|
using | value_type = typename std::iterator_traits<AIterator>::value_type |
| The type behind the iterator (make it possible to use the range as a "list")
|
|
|
template<class AOtherIterator> |
| SortedRange (const std::pair< AOtherIterator, AOtherIterator > &itPair) |
| Constructor to adapt a pair as returned by e.g. std::equal_range.
|
|
template<class Ts, class ItT = GetIterator<Ts>> |
| SortedRange (const Ts &ts) |
| Constructor from another range.
|
|
template<class T> |
SortedRange< AIterator > | equal_range (const T &t) const |
| Access to a sub range to mimic the behaviour of a sorted container.
|
|
template<class T> |
SortedRange< AIterator > | upper_bound (const T &t) const |
| Access to a upper bound to mimic the behaviour of a sorted container.
|
|
template<class T> |
SortedRange< AIterator > | lowers_bound (const T &t) const |
| Access to a lower bound to mimic the behaviour of a sorted container.
|
|
bool | count (Reference t) const |
| Counts the number of equivalent items in the range.
|
|
Iterator | begin () const |
| Begin of the range for range based for.
|
|
Iterator | end () const |
| End of the range for range based for.
|
|
bool | empty () const |
| Checks if the begin equals the end iterator, hence if the range is empty.
|
|
std::size_t | size () const |
| Returns the total number of objects in this range.
|
|
Reference | front () const |
| Returns the dereferenced iterator at begin()
|
|
Reference | back () const |
| Returns the dereferenced iterator before end()
|
|
Reference | operator[] (std::size_t i) const |
| Returns the object at index i.
|
|
Reference | at (std::size_t i) const |
| Returns the object at index i.
|
|
bool | count (Reference t) |
| Counts the number of equivalent items in the range.
|
|
|
T1 | first_type |
| STL member.
|
|
T2 | second_type |
| STL member.
|
|
|
using | Super = Range<AIterator> |
| Type of the base class.
|
|
template<class AIterator>
class Belle2::TrackFindingCDC::SortedRange< AIterator >
A pair of iterators usable with the range base for loop.
Definition at line 25 of file SortedRange.h.
◆ Iterator
template<class AIterator>
◆ iterator
template<class AIterator>
◆ Reference
template<class AIterator>
using Reference = typename std::iterator_traits<AIterator>::reference |
The type the iterator references.
Definition at line 36 of file SortedRange.h.
◆ Super
template<class AIterator>
◆ value_type
template<class AIterator>
using value_type = typename std::iterator_traits<AIterator>::value_type |
|
inherited |
The type behind the iterator (make it possible to use the range as a "list")
Definition at line 42 of file Range.h.
◆ SortedRange() [1/2]
template<class AIterator>
template<class AOtherIterator>
SortedRange |
( |
const std::pair< AOtherIterator, AOtherIterator > & | itPair | ) |
|
|
inlineexplicit |
Constructor to adapt a pair as returned by e.g. std::equal_range.
Definition at line 41 of file SortedRange.h.
42 : Super(AIterator(itPair.first), AIterator(itPair.second))
43 {}
◆ SortedRange() [2/2]
template<class AIterator>
template<class Ts, class ItT = GetIterator<Ts>>
Constructor from another range.
Definition at line 47 of file SortedRange.h.
48 : Super(AIterator(std::begin(ts)), AIterator(std::end(ts)))
49 {}
◆ at()
template<class AIterator>
Returns the object at index i.
Definition at line 92 of file Range.h.
93 {
94 if (not(i < size())) {
95 throw std::out_of_range("Range : Requested index " + std::to_string(i) + " is out of bounds.");
96 }
97 return operator[](i);
98 }
◆ back()
template<class AIterator>
Returns the dereferenced iterator before end()
Definition at line 84 of file Range.h.
85 { return *(end() - 1); }
◆ begin()
template<class AIterator>
Begin of the range for range based for.
Definition at line 64 of file Range.h.
65 { return this->first; }
◆ count() [1/2]
template<class AIterator>
Counts the number of equivalent items in the range.
Definition at line 101 of file Range.h.
102 { return std::count(this->begin(), this->end(), t); }
◆ count() [2/2]
template<class AIterator>
Counts the number of equivalent items in the range.
Definition at line 70 of file SortedRange.h.
71 {
72 Range<AIterator> relevant_range = this->equal_range(t);
73 return relevant_range.count(t);
74 }
◆ empty()
template<class AIterator>
Checks if the begin equals the end iterator, hence if the range is empty.
Definition at line 72 of file Range.h.
73 { return begin() == end(); }
◆ end()
template<class AIterator>
End of the range for range based for.
Definition at line 68 of file Range.h.
69 { return this->second; }
◆ equal_range()
template<class AIterator>
template<class T>
SortedRange< AIterator > equal_range |
( |
const T & | t | ) |
const |
|
inline |
Access to a sub range to mimic the behaviour of a sorted container.
Definition at line 56 of file SortedRange.h.
57 { return SortedRange<AIterator>(std::equal_range(this->begin(), this->end(), t)); }
◆ front()
template<class AIterator>
Returns the dereferenced iterator at begin()
Definition at line 80 of file Range.h.
81 { return *(begin()); }
◆ lowers_bound()
template<class AIterator>
template<class T>
SortedRange< AIterator > lowers_bound |
( |
const T & | t | ) |
const |
|
inline |
Access to a lower bound to mimic the behaviour of a sorted container.
Definition at line 66 of file SortedRange.h.
67 { return SortedRange<AIterator>(std::lower_bound(this->begin(), this->end(), t)); }
◆ operator[]()
template<class AIterator>
Returns the object at index i.
Definition at line 88 of file Range.h.
89 { return *(begin() + i); }
◆ size()
template<class AIterator>
std::size_t size |
( |
| ) |
const |
|
inlineinherited |
Returns the total number of objects in this range.
Definition at line 76 of file Range.h.
77 { return std::distance(begin(), end()); }
◆ upper_bound()
template<class AIterator>
template<class T>
SortedRange< AIterator > upper_bound |
( |
const T & | t | ) |
const |
|
inline |
Access to a upper bound to mimic the behaviour of a sorted container.
Definition at line 61 of file SortedRange.h.
62 { return SortedRange<AIterator>(std::upper_bound(this->begin(), this->end(), t)); }
The documentation for this class was generated from the following file: