25 #ifndef TVM_SUPPORT_SPAN_H_
26 #define TVM_SUPPORT_SPAN_H_
30 #include <type_traits>
41 template <
class T,
class W>
45 using const_W =
typename std::add_const<W>::type;
61 if (ptr_ != end_) ptr_++;
66 return ptr_ == other.ptr_ && end_ == other.end_;
71 template <class X = W1, typename = std::enable_if_t<!std::is_const<X>::value>>
95 ICHECK_LT(to_return,
end_) <<
"Span access out of bounds: " << i;
99 inline operator std::vector<W>() {
return std::vector<W>(
begin(),
end()); }
const W * pointer
Definition: span.h:53
bool operator!=(iterator_base< W1 > other)
Definition: span.h:69
iterator_base< W1 > & operator++()
Definition: span.h:60
W value_type
Definition: span.h:51
iterator_base(T *ptr, T *end)
Definition: span.h:56
const W & reference
Definition: span.h:54
bool operator==(iterator_base< W1 > other)
Definition: span.h:65
std::input_iterator_tag iterator_category
Definition: span.h:50
std::ptrdiff_t difference_type
Definition: span.h:52
W1 operator*()
Definition: span.h:58
A partial implementation of the C++20 std::span.
Definition: span.h:42
T * end_
Definition: span.h:103
W value_type
Definition: span.h:44
Span(T *begin, T *end)
Definition: span.h:85
Span(T *begin, int num_elements)
Definition: span.h:84
typename std::add_const< W >::type const_W
Definition: span.h:45
iterator begin() const
Definition: span.h:87
iterator end() const
Definition: span.h:89
W operator[](int i)
Definition: span.h:93
T * begin_
Definition: span.h:102
size_t size() const
Definition: span.h:91
iterator_base< W > iterator
Definition: span.h:81
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36