 |
Belle II Software
release-05-02-19
|
12 #include <tracking/trackFindingCDC/utilities/Range.h>
23 namespace TrackFindingCDC {
26 template<
class AIterator>
27 class SortedRange :
public Range<AIterator> {
31 using Super = Range<AIterator>;
38 using Reference =
typename std::iterator_traits<AIterator>::reference;
42 template<
class AOtherIterator>
43 explicit SortedRange(
const std::pair<AOtherIterator, AOtherIterator>& itPair)
44 :
Super(AIterator(itPair.first), AIterator(itPair.second))
48 template<
class Ts,
class ItT = GetIterator<Ts>>
69 {
return SortedRange<AIterator>(std::lower_bound(this->
begin(), this->
end(), t)); }
74 Range<AIterator> relevant_range = this->
equal_range(t);
75 return relevant_range.count(t);
Iterator begin() const
Begin of the range for range based for.
typename std::iterator_traits< AIterator >::reference Reference
The type the iterator references.
typename std::iterator_traits< AIterator >::reference Reference
The type the iterator references.
Iterator end() const
End of the range for range based for.
SortedRange< AIterator > lowers_bound(const T &t) const
Access to a lower bound to mimic the behaviour of a sorted container.
SortedRange< AIterator > upper_bound(const T &t) const
Access to a upper bound to mimic the behaviour of a sorted container.
SortedRange< AIterator > equal_range(const T &t) const
Access to a sub range to mimic the behaviour of a sorted container.
Abstract base class for different kinds of events.
AIterator Iterator
Iterator type of the range.
Range< AIterator > Super
Type of the base class.
std::pair< AIterator, AIterator > Super
Type of the base class.
SortedRange(const std::pair< AOtherIterator, AOtherIterator > &itPair)
Constructor to adapt a pair as returned by e.g. std::equal_range.
bool count(Reference t) const
Counts the number of equivalent items in the range.
A pair of iterators usable with the range base for loop.