17#ifndef ROOFIT_ROOFITCORE_INC_ROOSPAN_H_
18#define ROOFIT_ROOFITCORE_INC_ROOSPAN_H_
34 using iterator =
typename std::span<T>::iterator;
53 template<
typename NON_CONST_T,
54 typename =
typename std::enable_if<std::is_same<const NON_CONST_T, T>::value>
::type >
61 template <
class InputIterator>
62 constexpr RooSpan(InputIterator beginIn, InputIterator endIn) :
69 constexpr RooSpan(
typename std::span<T>::pointer beginIn,
70 typename std::span<T>::pointer endIn) :
77 constexpr RooSpan(
typename std::span<T>::pointer beginIn,
78 typename std::span<T>::index_type sizeIn) :
80 _span{beginIn, sizeIn}
98 constexpr RooSpan(std::vector<value_type>&& payload) :
107 constexpr typename std::span<T>::iterator
begin()
const {
108 return _span.begin();
111 constexpr typename std::span<T>::iterator
end()
const {
115 constexpr typename std::span<T>::pointer
data()
const {
119 constexpr typename std::span<T>::reference
operator[](
typename std::span<T>::index_type i)
const noexcept {
123 constexpr typename std::span<T>::index_type
size() const noexcept {
127 constexpr bool empty() const noexcept {
128 return _span.empty();
137 template <
class Span_t>
140 || other.insideSpan(
begin()) || other.insideSpan(
end()-1);
144 template <
typename ptr_t>
146 return begin() <= ptr && ptr <
end();
A simple container to hold a batch of data values.
constexpr RooSpan(std::vector< typename std::remove_cv< T >::type > &vec) noexcept
constexpr std::span< T >::reference operator[](typename std::span< T >::index_type i) const noexcept
bool insideSpan(ptr_t ptr) const
Test if the given pointer/iterator is inside the span.
bool overlaps(const Span_t &other) const
Test if the span overlaps with other.
constexpr std::span< T >::iterator end() const
RooSpan< T > & operator=(const RooSpan< T > &other)=default
typename std::remove_cv< T >::type value_type
constexpr RooSpan(InputIterator beginIn, InputIterator endIn)
Construct from a range. Data held by foreign object.
std::shared_ptr< std::vector< value_type > > _auxStorage
If a class does not own a contiguous block of memory, which could be used to create a span,...
constexpr RooSpan(const RooSpan< NON_CONST_T > &other)
Conversion constructor from <T> to <const T>
constexpr std::span< T >::pointer data() const
constexpr std::span< T >::index_type size() const noexcept
constexpr RooSpan(const RooSpan &other)
constexpr RooSpan(typename std::span< T >::pointer beginIn, typename std::span< T >::pointer endIn)
Construct from start and end pointers.
constexpr RooSpan(RooSpan &&other)
typename std::span< T >::iterator iterator
constexpr RooSpan(typename std::span< T >::pointer beginIn, typename std::span< T >::index_type sizeIn)
Construct from start pointer and size.
constexpr RooSpan(std::vector< value_type > &&payload)
Hand data over to this span.
constexpr bool isBatch() const noexcept
constexpr RooSpan(const std::vector< typename std::remove_cv< T >::type > &vec) noexcept
constexpr std::span< T >::iterator begin() const
constexpr bool empty() const noexcept
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN