14#ifndef ROOT_RRangeCast
15#define ROOT_RRangeCast
29 using type =
typename std::remove_pointer<typename std::decay<T>::type>
::type;
32#if (__cplusplus < 201700L)
34template <
typename T,
bool isDynamic = true,
bool isPolymorphic = std::is_polymorphic<RBaseType<T>>::value>
39 return dynamic_cast<T
>(u);
48 return static_cast<T
>(u);
57 assert(
dynamic_cast<T
>(u));
58 return static_cast<T
>(u);
66constexpr auto hasBeginEnd(
int) ->
decltype(std::begin(std::declval<T>()), std::end(std::declval<T>()),
true)
77template <
typename T,
typename WrappedIterator_t,
bool isDynamic>
107#if (__cplusplus < 201700L)
112 if constexpr (isDynamic) {
113 return dynamic_cast<T
>(*fIter);
115 if constexpr (std::is_polymorphic<RBaseType<T>>
::value) {
116 assert(
dynamic_cast<T
>(*
fIter));
118 return static_cast<T
>(*fIter);
134template <
typename T,
bool isDynamic,
typename Range_t>
140 static_assert(ROOT::Internal::hasBeginEnd<Range_t>(0),
141 "Type with no `begin` or `end` method passed to `RRangeCast`");
177template <
typename T,
typename Range_t>
180 return std::forward<Range_t>(coll);
185template <
typename T,
typename U, std::
size_t N>
188 return std::span<U>(arr, arr +
N);
216template <
typename T,
typename Range_t>
219 return std::forward<Range_t>(coll);
224template <
typename T,
typename U, std::
size_t N>
227 return std::span<U>(arr, arr +
N);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
bool operator!=(const TypedIter &rhs) const
TypedIter(WrappedIterator_t const &iter)
bool operator==(const TypedIter &rhs) const
TypedIter operator++(int)
void swap(TypedIter &other)
Wraps any collection that can be used in range-based loops and applies static_cast<T> or dynamic_cast...
const_iterator begin() const
const_iterator end() const
RRangeCast(Range_t &&inputRange)
constexpr auto hasBeginEnd(int) -> decltype(std::begin(std::declval< T >()), std::end(std::declval< T >()), true)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
RRangeCast< T, false, Range_t > RangeStaticCast(Range_t &&coll)
Takes any collection that can be used in range-based loops and applies static_cast<T> to each element...
RRangeCast< T, true, Range_t > RangeDynCast(Range_t &&coll)
Takes any collection that can be used in range-based loops and applies dynamic_cast<T> to each elemen...
typename std::remove_pointer< typename std::decay< T >::type >::type type