Public Types | Public Member Functions | Protected Attributes | List of all members
cudf::detail::base_2dspan< T, RowType > Class Template Reference

Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax. More...

#include <span.hpp>

Public Types

using size_type = std::pair< size_t, size_t >
 Type used to represent the dimension of the span.
 

Public Member Functions

constexpr base_2dspan (RowType< T, dynamic_extent > flat_view, size_t columns)
 Constructor from a span and number of elements in each row. More...
 
constexpr auto data () const noexcept
 Returns a pointer to the beginning of the sequence. More...
 
constexpr auto size () const noexcept
 Returns the size in the span as pair. More...
 
constexpr auto count () const noexcept
 Returns the number of elements in the span. More...
 
constexpr bool is_empty () const noexcept
 Checks if the span is empty. More...
 
constexpr RowType< T, dynamic_extentoperator[] (size_t row) const
 Returns a reference to the row-th element of the sequence. More...
 
constexpr RowType< T, dynamic_extentflat_view () const
 Returns a flattened span of the 2D span. More...
 
template<typename OtherT , template< typename, size_t > typename OtherRowType, std::enable_if_t< std::is_convertible_v< OtherRowType< OtherT, dynamic_extent >, RowType< T, dynamic_extent >>, void > * = nullptr>
constexpr base_2dspan (base_2dspan< OtherT, OtherRowType > const &other) noexcept
 Construct a 2D span from another 2D span of convertible type. More...
 

Protected Attributes

RowType< T, dynamic_extent_flat
 flattened 2D span
 
size_type _size {0, 0}
 num rows, num columns
 

Detailed Description

template<typename T, template< typename, std::size_t > typename RowType>
class cudf::detail::base_2dspan< T, RowType >

Generic class for row-major 2D spans. Not compliant with STL container semantics/syntax.

The index operator returns the corresponding row.

Definition at line 405 of file span.hpp.

Constructor & Destructor Documentation

◆ base_2dspan() [1/2]

template<typename T , template< typename, std::size_t > typename RowType>
constexpr cudf::detail::base_2dspan< T, RowType >::base_2dspan ( RowType< T, dynamic_extent flat_view,
size_t  columns 
)
inlineconstexpr

Constructor from a span and number of elements in each row.

Parameters
flat_viewThe flattened 2D span
columnsNumber of columns

Definition at line 417 of file span.hpp.

◆ base_2dspan() [2/2]

template<typename T , template< typename, std::size_t > typename RowType>
template<typename OtherT , template< typename, size_t > typename OtherRowType, std::enable_if_t< std::is_convertible_v< OtherRowType< OtherT, dynamic_extent >, RowType< T, dynamic_extent >>, void > * = nullptr>
constexpr cudf::detail::base_2dspan< T, RowType >::base_2dspan ( base_2dspan< OtherT, OtherRowType > const &  other)
inlineconstexprnoexcept

Construct a 2D span from another 2D span of convertible type.

Template Parameters
OtherTType of the other 2D span
OtherRowTypeType of the row of the other 2D span
Parameters
otherThe other 2D span

Definition at line 485 of file span.hpp.

Member Function Documentation

◆ count()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::count ( ) const
inlineconstexprnoexcept

Returns the number of elements in the span.

Returns
Number of elements in the span

Definition at line 442 of file span.hpp.

◆ data()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::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 428 of file span.hpp.

◆ flat_view()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::flat_view ( ) const
inlineconstexpr

Returns a flattened span of the 2D span.

Returns
A flattened span of the 2D span

Definition at line 470 of file span.hpp.

◆ is_empty()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr bool cudf::detail::base_2dspan< T, RowType >::is_empty ( ) const
inlineconstexprnoexcept

Checks if the span is empty.

Returns
True if the span is empty, false otherwise

Definition at line 449 of file span.hpp.

◆ operator[]()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr RowType<T, dynamic_extent> cudf::detail::base_2dspan< T, RowType >::operator[] ( size_t  row) const
inlineconstexpr

Returns a reference to the row-th element of the sequence.

The behavior is undefined if row is out of range (i.e., if it is greater than or equal to size()).

Parameters
rowthe index of the element to access
Returns
A reference to the row-th element of the sequence, i.e., data()[row]

Definition at line 460 of file span.hpp.

◆ size()

template<typename T , template< typename, std::size_t > typename RowType>
constexpr auto cudf::detail::base_2dspan< T, RowType >::size ( ) const
inlineconstexprnoexcept

Returns the size in the span as pair.

Returns
pair representing rows and columns size of the span

Definition at line 435 of file span.hpp.


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