Utility Span#
- group utility_span
Variables
-
constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max()#
A constant used to differentiate std::span of static and dynamic extent.
-
template<typename T>
struct is_host_span_supported_container : public std::false_type#
-
template<typename T, typename Alloc>
struct is_host_span_supported_container<std::vector<T, Alloc>> : public std::true_type#
-
template<typename T, typename Alloc>
struct is_host_span_supported_container<thrust::host_vector<T, Alloc>> : public std::true_type#
-
template<typename T, typename Alloc>
struct is_host_span_supported_container<std::basic_string<T, std::char_traits<T>, Alloc>> : public std::true_type#
-
template<typename T, std::size_t Extent = cudf::dynamic_extent>
struct host_span : public cudf::detail::span_base<T, cudf::dynamic_extent, host_span<T, cudf::dynamic_extent>># - #include <span.hpp>
C++20 std::span with reduced feature set.
Public Functions
-
inline constexpr host_span(T *data, std::size_t size, bool is_device_accessible)#
Constructor from pointer and size
- Parameters:
data – Pointer to the first element in the span
size – The number of elements in the span
is_device_accessible – Whether the data is device accessible (e.g. pinned memory)
-
template<typename C>
inline constexpr host_span(C &in)# Constructor from container
- Parameters:
in – The container to construct the span from
-
template<typename C>
inline constexpr host_span(C const &in)# Constructor from const container
- Parameters:
in – The container to construct the span from
-
template<typename OtherT>
inline constexpr host_span(cudf::detail::host_vector<OtherT> &in)# Constructor from a host_vector
- Parameters:
in – The host_vector to construct the span from
-
template<typename OtherT>
inline constexpr host_span(cudf::detail::host_vector<OtherT> const &in)# Constructor from a const host_vector
- Parameters:
in – The host_vector to construct the span from
-
template<typename OtherT, std::size_t OtherExtent>
inline constexpr host_span(host_span<OtherT, OtherExtent> const &other) noexcept# - Parameters:
other – The span to copy
-
inline constexpr base::reference operator[](size_type idx) const#
Returns a reference to the idx-th element of the sequence.
The behavior is undefined if idx is out of range (i.e., if it is greater than or equal to size()).
- Parameters:
idx – the index of the element to access
- Returns:
A reference to the idx-th element of the sequence, i.e.,
data()[idx]
-
inline constexpr base::reference front() const#
Returns a reference to the first element in the span.
Calling front on an empty span results in undefined behavior.
- Returns:
Reference to the first element in the span
-
inline constexpr base::reference back() const#
Returns a reference to the last element in the span.
Calling last on an empty span results in undefined behavior.
- Returns:
Reference to the last element in the span
-
inline bool is_device_accessible() const#
Returns whether the data is device accessible (e.g. pinned memory)
- Returns:
true if the data is device accessible
-
inline constexpr host_span subspan(typename base::size_type offset, typename base::size_type count) const noexcept#
Obtains a span that is a view over the
count
elements of this span starting at offset.- Parameters:
offset – The offset of the first element in the subspan
count – The number of elements in the subspan
- Returns:
A subspan of the sequence, of requested count and offset
-
inline constexpr host_span(T *data, std::size_t size, bool is_device_accessible)#
-
template<typename T>
struct is_device_span_supported_container : public std::false_type#
-
template<typename T, typename Alloc>
struct is_device_span_supported_container<thrust::device_vector<T, Alloc>> : public std::true_type#
-
template<typename T>
struct is_device_span_supported_container<rmm::device_vector<T>> : public std::true_type#
-
template<typename T>
struct is_device_span_supported_container<rmm::device_uvector<T>> : public std::true_type#
-
template<typename T, std::size_t Extent = cudf::dynamic_extent>
struct device_span : public cudf::detail::span_base<T, cudf::dynamic_extent, device_span<T, cudf::dynamic_extent>># - #include <span.hpp>
Device version of C++20 std::span with reduced feature set.
Public Functions
-
template<typename C>
inline constexpr device_span(C &in)# Constructor from container
- Parameters:
in – The container to construct the span from
-
template<typename C>
inline constexpr device_span(C const &in)# Constructor from const container
- Parameters:
in – The container to construct the span from
-
template<typename OtherT, std::size_t OtherExtent>
inline constexpr device_span(device_span<OtherT, OtherExtent> const &other) noexcept# - Parameters:
other – The span to copy
-
inline constexpr base::reference operator[](size_type idx) const#
Returns a reference to the idx-th element of the sequence.
The behavior is undefined if idx is out of range (i.e., if it is greater than or equal to size()).
- Parameters:
idx – the index of the element to access
- Returns:
A reference to the idx-th element of the sequence, i.e.,
data()[idx]
-
inline constexpr base::reference front() const#
Returns a reference to the first element in the span.
Calling front on an empty span results in undefined behavior.
- Returns:
Reference to the first element in the span
-
inline constexpr base::reference back() const#
Returns a reference to the last element in the span.
Calling last on an empty span results in undefined behavior.
- Returns:
Reference to the last element in the span
-
inline constexpr device_span subspan(typename base::size_type offset, typename base::size_type count) const noexcept#
Obtains a span that is a view over the
count
elements of this span starting at offset.- Parameters:
offset – The offset of the first element in the subspan
count – The number of elements in the subspan
- Returns:
A subspan of the sequence, of requested count and offset
-
template<typename C>
-
constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max()#