Public Types | Public Member Functions | Static Public 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 span_base (pointer data, size_type size)
 Constructs a span from a pointer and a size. More...
 
constexpr span_base (span_base const &) noexcept=default
 Copy constructor.
 
constexpr span_baseoperator= (span_base const &) noexcept=default
 Copy assignment operator. More...
 
constexpr reference front () const
 Returns a reference to the first element in the span. More...
 
constexpr reference back () const
 Returns a reference to the last element in the span. More...
 
constexpr reference operator[] (size_type idx) const
 Returns a reference to the idx-th element of the sequence. More...
 
constexpr iterator begin () const noexcept
 Returns an iterator to the first element of the span. More...
 
constexpr iterator end () const noexcept
 Returns an iterator to the element following the last element of the span. More...
 
constexpr pointer data () const noexcept
 Returns a pointer to the beginning of the sequence. More...
 
constexpr size_type size () const noexcept
 Returns the number of elements in the span. More...
 
constexpr size_type size_bytes () const noexcept
 Returns the size of the sequence in bytes. More...
 
constexpr 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...
 
constexpr Derived subspan (size_type offset, size_type count) const noexcept
 Obtains a span that is a view over the count elements of this span starting at offset. More...
 

Static Public Attributes

static constexpr std::size_t extent = Extent
 The extent of 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 51 of file span.hpp.

Constructor & Destructor Documentation

◆ span_base()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 75 of file span.hpp.

Member Function Documentation

◆ back()

template<typename T , std::size_t Extent, typename Derived >
constexpr reference cudf::detail::span_base< T, Extent, Derived >::back ( ) const
inlineconstexpr

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

Definition at line 102 of file span.hpp.

◆ begin()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 122 of file span.hpp.

◆ data()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 136 of file span.hpp.

◆ empty()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 155 of file span.hpp.

◆ end()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 130 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 163 of file span.hpp.

◆ front()

template<typename T , std::size_t Extent, typename Derived >
constexpr reference cudf::detail::span_base< T, Extent, Derived >::front ( ) const
inlineconstexpr

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

Definition at line 93 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 171 of file span.hpp.

◆ operator=()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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.

◆ operator[]()

template<typename T , std::size_t Extent, typename Derived >
constexpr reference cudf::detail::span_base< T, Extent, Derived >::operator[] ( size_type  idx) const
inlineconstexpr

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
idxthe index of the element to access
Returns
A reference to the idx-th element of the sequence, i.e., data()[idx]

Definition at line 113 of file span.hpp.

◆ size()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 143 of file span.hpp.

◆ size_bytes()

template<typename T , std::size_t Extent, typename Derived >
constexpr 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 149 of file span.hpp.

◆ subspan()

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

Obtains a span that is a view over the count elements of this span starting at offset.

Parameters
offsetThe offset of the first element in the subspan
countThe number of elements in the subspan
Returns
A subspan of the sequence, of requested count and offset

Definition at line 183 of file span.hpp.


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