span: One-dimensional Non-owning View#

#include <raft/core/span.hpp>

using element_type = T#
using value_type = typename std::remove_cv<T>::type#
using size_type = std::size_t#
using difference_type = std::ptrdiff_t#
using pointer = T*#
using const_pointer = T const*#
using reference = T&#
using const_reference = T const&#
using iterator = pointer#
using const_iterator = const_pointer#
using reverse_iterator = thrust::reverse_iterator<iterator>#
using const_reverse_iterator = thrust::reverse_iterator<const_iterator>#
constexpr span() noexcept = default#

Default constructor that constructs a span with size 0 and nullptr.

inline constexpr span(pointer ptr, size_type count) noexcept#

Constructs a span that is a view over the range [first, first + count);.

inline constexpr span(pointer first, pointer last) noexcept#

Constructs a span that is a view over the range [first, last)

template<std::size_t N>
inline constexpr span(element_type (&arr)[N]) noexcept#

Constructs a span that is a view over the array arr.

template<class U, std::size_t OtherExtent, class = typename std::enable_if<detail::is_allowed_element_type_conversion_t<U, T>::value && detail::is_allowed_extent_conversion_t<OtherExtent, Extent>::value>>
inline constexpr span(const span<U, is_device, OtherExtent> &other) noexcept#

Initialize a span class from another one who’s underlying type is convertible to element_type.

constexpr span(span const &other) noexcept = default#
constexpr span(span &&other) noexcept = default#
constexpr auto operator=(span const &other) noexcept -> span& = default#
constexpr auto operator=(span &&other) noexcept -> span& = default#
inline constexpr auto begin() const noexcept -> iterator#
inline constexpr auto end() const noexcept -> iterator#
inline constexpr auto cbegin() const noexcept -> const_iterator#
inline constexpr auto cend() const noexcept -> const_iterator#
inline _RAFT_HOST_DEVICE constexpr auto rbegin () const noexcept -> reverse_iterator
inline _RAFT_HOST_DEVICE constexpr auto rend () const noexcept -> reverse_iterator
inline _RAFT_HOST_DEVICE constexpr auto crbegin () const noexcept -> const_reverse_iterator
inline _RAFT_HOST_DEVICE constexpr auto crend () const noexcept -> const_reverse_iterator
inline constexpr auto front() const -> reference#
inline constexpr auto back() const -> reference#
template<typename Index>
inline constexpr auto operator[](Index _idx) const -> reference#
inline constexpr auto data() const noexcept -> pointer#
inline constexpr auto size() const noexcept -> size_type#
inline constexpr auto size_bytes() const noexcept -> size_type#
inline constexpr auto empty() const noexcept#
template<std::size_t Count>
inline constexpr auto first() const -> span<element_type, is_device, Count>#
inline constexpr auto first(std::size_t _count) const -> span<element_type, is_device, dynamic_extent>#
template<std::size_t Count>
inline constexpr auto last() const -> span<element_type, is_device, Count>#
inline constexpr auto last(std::size_t _count) const -> span<element_type, is_device, dynamic_extent>#
template<std::size_t Offset, std::size_t Count = dynamic_extent>
inline constexpr auto subspan() const -> span<element_type, is_device, detail::extent_value_t<Extent, Offset, Count>::value>#

If Count is std::dynamic_extent, r.size() == this->size() - Offset; Otherwise r.size() == Count.

inline constexpr auto subspan(size_type _offset, size_type _count = dynamic_extent) const -> span<element_type, is_device, dynamic_extent>#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator==(span<T, is_device, X> l, span<U, is_device, Y> r) -> bool#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator!=(span<T, is_device, X> l, span<U, is_device, Y> r)#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator<(span<T, is_device, X> l, span<U, is_device, Y> r)#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator<=(span<T, is_device, X> l, span<U, is_device, Y> r)#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator>(span<T, is_device, X> l, span<U, is_device, Y> r)#
template<class T, std::size_t X, class U, std::size_t Y, bool is_device>
constexpr auto operator>=(span<T, is_device, X> l, span<U, is_device, Y> r)#
template<class T, bool is_device, std::size_t E>
auto as_bytes(span<T, is_device, E> s) noexcept -> span<const std::byte, is_device, detail::extent_as_bytes_value_t<T, E>::value>#

Converts a span into a view of its underlying bytes.

template<class T, bool is_device, std::size_t E>
auto as_writable_bytes(span<T, is_device, E> s) noexcept -> span<std::byte, is_device, detail::extent_as_bytes_value_t<T, E>::value>#

Converts a span into a mutable view of its underlying bytes.

template<typename T, bool is_device, std::size_t Extent = dynamic_extent>
class span#
#include <span.hpp>

The span class defined in ISO C++20. Iterator is defined as plain pointer and most of the methods have bound check on debug build.

rmm::device_uvector<float> uvec(10, rmm::cuda_stream_default);
auto view = device_span<float>{uvec.data(), uvec.size()};

#include <raft/core/device_span.hpp>

template<typename T, size_t extent = std::experimental::dynamic_extent>
using device_span = span<T, true, extent>#

A span class for device pointer.

#include <raft/core/host_span.hpp>

template<typename T, size_t extent = std::experimental::dynamic_extent>
using host_span = span<T, false, extent>#

A span class for host pointer.