Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
cudf::detail::span_base< T, Extent, Derived > Class Template Reference

C++20 std::span with reduced feature set. More...

#include <span.hpp>

Inheritance diagram for cudf::detail::span_base< T, Extent, Derived >:
cudf::device_span< detail::dremel_device_view const >

Public Types

using element_type = T
 The type of the elements in the span.
 
using value_type = std::remove_cv< T >
 Stored value type.
 
using size_type = std::size_t
 The type used for the size of the span.
 
using difference_type = std::ptrdiff_t
 std::ptrdiff_t
 
using pointer = T *
 The type of the pointer returned by data()
 
using iterator = T *
 The type of the iterator returned by begin()
 
using const_pointer = T const *
 The type of the pointer returned by data() const.
 
using reference = T &
 The type of the reference returned by operator[](size_type)
 
using const_reference = T const &
 The type of the reference returned by operator[](size_type) const.
 

Public Member Functions

constexpr CUDF_HOST_DEVICE span_base (pointer data, size_type size)
 Constructs a span from a pointer and a size. More...
 
constexpr CUDF_HOST_DEVICE span_base (span_base const &) noexcept=default
 Copy constructor.
 
constexpr CUDF_HOST_DEVICE span_baseoperator= (span_base const &) noexcept=default
 Copy assignment operator. More...
 
constexpr CUDF_HOST_DEVICE iterator begin () const noexcept
 Returns an iterator to the first element of the span. More...
 
constexpr CUDF_HOST_DEVICE iterator end () const noexcept
 Returns an iterator to the element following the last element of the span. More...
 
constexpr CUDF_HOST_DEVICE pointer data () const noexcept
 Returns a pointer to the beginning of the sequence. More...
 
constexpr CUDF_HOST_DEVICE size_type size () const noexcept
 Returns the number of elements in the span. More...
 
constexpr CUDF_HOST_DEVICE size_type size_bytes () const noexcept
 Returns the size of the sequence in bytes. More...
 
constexpr CUDF_HOST_DEVICE bool empty () const noexcept
 Checks if the span is empty. More...
 
constexpr Derived first (size_type count) const noexcept
 Obtains a subspan consisting of the first N elements of the sequence. More...
 
constexpr Derived last (size_type count) const noexcept
 Obtains a subspan consisting of the last N elements of the sequence. More...
 

Static Public Attributes

static constexpr std::size_t extent = Extent
 The extent of the span.
 

Protected Attributes

pointer _data {nullptr}
 Pointer to the first element in the span.
 
size_type _size {0}
 The number of elements in the span.
 

Detailed Description

template<typename T, std::size_t Extent, typename Derived>
class cudf::detail::span_base< T, Extent, Derived >

C++20 std::span with reduced feature set.

Definition at line 56 of file span.hpp.

Constructor & Destructor Documentation

◆ span_base()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE cudf::detail::span_base< T, Extent, Derived >::span_base ( pointer  data,
size_type  size 
)
inlineconstexpr

Constructs a span from a pointer and a size.

Parameters
dataPointer to the first element in the span.
sizeThe number of elements in the span.

Definition at line 80 of file span.hpp.

Member Function Documentation

◆ begin()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE iterator cudf::detail::span_base< T, Extent, Derived >::begin ( ) const
inlineconstexprnoexcept

Returns an iterator to the first element of the span.

If the span is empty, the returned iterator will be equal to end().

Returns
An iterator to the first element of the span

Definition at line 97 of file span.hpp.

◆ data()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE pointer cudf::detail::span_base< T, Extent, Derived >::data ( ) const
inlineconstexprnoexcept

Returns a pointer to the beginning of the sequence.

Returns
A pointer to the first element of the span

Definition at line 111 of file span.hpp.

◆ empty()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE bool cudf::detail::span_base< T, Extent, Derived >::empty ( ) const
inlineconstexprnoexcept

Checks if the span is empty.

Returns
True if the span is empty, false otherwise

Definition at line 134 of file span.hpp.

◆ end()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE iterator cudf::detail::span_base< T, Extent, Derived >::end ( ) const
inlineconstexprnoexcept

Returns an iterator to the element following the last element of the span.

This element acts as a placeholder; attempting to access it results in undefined behavior.

Returns
An iterator to the element following the last element of the span

Definition at line 105 of file span.hpp.

◆ first()

template<typename T , std::size_t Extent, typename Derived >
constexpr Derived cudf::detail::span_base< T, Extent, Derived >::first ( size_type  count) const
inlineconstexprnoexcept

Obtains a subspan consisting of the first N elements of the sequence.

Parameters
countNumber of elements from the beginning of this span to put in the subspan.
Returns
A subspan of the first N elements of the sequence

Definition at line 142 of file span.hpp.

◆ last()

template<typename T , std::size_t Extent, typename Derived >
constexpr Derived cudf::detail::span_base< T, Extent, Derived >::last ( size_type  count) const
inlineconstexprnoexcept

Obtains a subspan consisting of the last N elements of the sequence.

Parameters
countNumber of elements from the end of this span to put in the subspan
Returns
A subspan of the last N elements of the sequence

Definition at line 153 of file span.hpp.

◆ operator=()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE span_base& cudf::detail::span_base< T, Extent, Derived >::operator= ( span_base< T, Extent, Derived > const &  )
constexprdefaultnoexcept

Copy assignment operator.

Returns
Reference to this span.

◆ size()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE size_type cudf::detail::span_base< T, Extent, Derived >::size ( ) const
inlineconstexprnoexcept

Returns the number of elements in the span.

Returns
The number of elements in the span

Definition at line 118 of file span.hpp.

◆ size_bytes()

template<typename T , std::size_t Extent, typename Derived >
constexpr CUDF_HOST_DEVICE size_type cudf::detail::span_base< T, Extent, Derived >::size_bytes ( ) const
inlineconstexprnoexcept

Returns the size of the sequence in bytes.

Returns
The size of the sequence in bytes

Definition at line 124 of file span.hpp.


The documentation for this class was generated from the following file: