82 #ifndef LARDATA_UTILITIES_COLLECTIONVIEW_H
83 #define LARDATA_UTILITIES_COLLECTIONVIEW_H
90 #include <type_traits>
97 template <
typename Range>
104 template <
typename Range>
113 = std::decay_t<decltype(traits_t::getCBegin(std::declval<range_t>()))>;
115 = std::decay_t<decltype(traits_t::getCEnd(std::declval<range_t>()))>;
121 template <
typename BeginIter,
typename EndIter = BeginIter>
148 template <
typename BeginIter,
typename EndIter>
154 template <
typename Range>
164 template <
typename Range>
285 template <
typename Range>
286 class CollectionView:
private Range {
375 throw std::out_of_range(
376 "CollectionView index out of range: "
399 CollectionViewWrapper() = default;
400 CollectionViewWrapper(this_t const&) = default;
401 CollectionViewWrapper(this_t&&) = default;
402 CollectionViewWrapper& operator=(this_t const&) = default;
403 CollectionViewWrapper& operator=(this_t&&) = default;
412 friend this_t details::makeCollectionView<range_t>(
range_t&&);
424 template <
typename Range>
431 template <
typename BeginIter,
typename EndIter>
438 template <
typename BeginIter,
typename EndIter = BeginIter>
445 template <
typename Range>
454 #endif // LARDATA_UTILITIES_COLLECTIONVIEW_H
const_iterator begin() const noexcept
Returns an iterator to the begin of the collection.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Provides features of a collections, from begin and end iterators.
auto makeCollectionExtremes(BeginIter const &b, EndIter const &e)
Helper to create a CollectionExtremes object from two iterators.
typename iter_traits_t::reference const_reference
size_type size() const noexcept
Returns the size of the collection.
bool empty() const noexcept
Returns whether the collection is empty.
std::decay_t< decltype(traits_t::getCBegin(std::declval< range_t >()))> begin_iterator_t
auto back() const -> decltype(auto)
Returns the last element in the collection.
range_t collection_type
Type of collection being wrapped.
typename iter_traits_t::value_type value_type
decltype(makeCollectionView(std::declval< BeginIter >(), std::declval< EndIter >())) RangeAsCollection_t
Type of collection view owning the two range boundary iterators.
const_reverse_iterator rbegin() const noexcept
Returns a reverse iterator to the begin of the collection.
CollectionView< Range > this_t
This type.
auto cbegin(FixedBins< T, C > const &) noexcept
const_reverse_iterator rend() const noexcept
Returns a reverse iterator past the end of the collection.
begin_iterator_t b
Stored copy of begin iterator.
end_iter_t cend() const noexcept
Returns an iterator past the end of the collection.
typename iter_traits_t::difference_type difference_type
typename traits_t::end_iterator_t end_iter_t
Type of the end iterator.
CollectionExtremes(BeginIter b, EndIter e)
Constructor: copies the specified iterators.
end_iterator_t const & end() const
Returns the stored end iterator.
BoundaryListRangeBase< BoundaryIter > range_t
Type of the range being wrapped.
CollectionView(range_t &&range)
Constructor: steals the data from the specified range.
auto cend(FixedBins< T, C > const &) noexcept
const_reverse_iterator crbegin() const noexcept
Returns a reverse iterator to the begin of the collection.
CollectionView< Range > makeCollectionView(Range &&)
A range (interval) of integers.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Class storing a begin and a end iterator.
end_iter_t end() const noexcept
Returns an iterator past the end of the collection.
auto operator[](size_type i) const -> decltype(auto)
Returns the content of the i-th element.
auto at(size_type i) const -> decltype(auto)
Returns the content of the i-th element.
const_iterator cbegin() const noexcept
Returns an iterator to the begin of the collection.
auto makeCollectionView(BeginIter const &b, EndIter const &e)
Creates a CollectionView from the specified iterators.
range_t const & asRange() const
Returns this very object, cast back to range_t.
std::reverse_iterator< const_iterator > const_reverse_iterator
typename traits_t::begin_iterator_t begin_iter_t
Type of the begin iterator.
begin_iterator_t const & begin() const
Returns the stored begin iterator.
std::iterator_traits< begin_iter_t > iter_traits_t
Type of traits of iterator.
std::string to_string(WindowPattern const &pattern)
auto front() const -> decltype(auto)
Returns the first element in the collection.
static constexpr FromContainerTag fromContainer
static auto getCEnd(range_t const &range)
typename iter_traits_t::pointer const_pointer
begin_iter_t const_iterator
end_iterator_t e
Stored copy of end iterator.
CollectionView< Range > const & wrapCollectionIntoView(Range const &c)
Returns the specified container, wrapped in the view.
const_reverse_iterator crend() const noexcept
Returns a reverse iterator past the end of the collection.
std::decay_t< decltype(traits_t::getCEnd(std::declval< range_t >()))> end_iterator_t
const_pointer data() const
static auto getCBegin(range_t const &range)