Itoyori  v0.0.1
ityr::global_span< T > Class Template Reference

Global span to represent a view of a global memory range. More...

#include <global_span.hpp>

Public Types

using element_type = T
 
using value_type = std::remove_cv_t< element_type >
 
using size_type = std::size_t
 
using pointer = ori::global_ptr< element_type >
 
using const_pointer = ori::global_ptr< std::add_const_t< element_type > >
 
using difference_type = typename std::iterator_traits< pointer >::difference_type
 
using reference = typename std::iterator_traits< pointer >::reference
 
using const_reference = typename std::iterator_traits< const_pointer >::reference
 
using iterator = pointer
 
using const_iterator = const_pointer
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

constexpr global_span () noexcept
 
template<typename ContiguousIterator >
constexpr global_span (ContiguousIterator first, size_type n)
 
template<typename ContiguousIterator >
constexpr global_span (ContiguousIterator first, ContiguousIterator last)
 
template<typename R >
constexpr global_span (R &&r)
 
template<typename U >
constexpr global_span (const global_span< U > &s) noexcept
 
constexpr global_span (const this_t &other) noexcept=default
 
constexpr this_toperator= (const this_t &other) noexcept=default
 
constexpr pointer data () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr iterator begin () const noexcept
 
constexpr iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr reverse_iterator rbegin () const noexcept
 
constexpr reverse_iterator rend () const noexcept
 
constexpr const_reverse_iterator crbegin () const noexcept
 
constexpr const_reverse_iterator crend () const noexcept
 
constexpr reference operator[] (size_type i) const
 
constexpr reference front () const
 
constexpr reference back () const
 
constexpr bool empty () const noexcept
 
constexpr this_t subspan (size_type offset, size_type count) const
 

Detailed Description

template<typename T>
class ityr::global_span< T >

Global span to represent a view of a global memory range.

A global span is a view of a global memory range.

Similar to std::span (C++20), a global span does not hold any ownership for the range. Because of this, ityr::global_span will frequently appear in Itoyori programs, as it can be copied across different parallel tasks without copying the actual data stored in global memory.

Example:

ityr::global_vector<int> v = {1, 2, 3, 4, 5};
// `s` can be copied without creating a copy of the actual data in `v`.
// If `v` were passed to child tasks, the actual data would be copied.
Global span to represent a view of a global memory range.
Definition: global_span.hpp:33
Global vector to manage a global memory region.
Definition: global_vector.hpp:129
constexpr read_t read
Read-only checkout mode.
Definition: checkout_span.hpp:19
auto parallel_invoke(Args &&... args)
Fork parallel tasks and join them.
Definition: parallel_invoke.hpp:238
checkout_span< T, Mode > make_checkout(ori::global_ptr< T > gptr, std::size_t n, Mode mode)
Checkout a global memory region.
Definition: checkout_span.hpp:238
See also
std::span – cppreference.com
ityr::make_checkout().
ityr::global_vector.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using ityr::global_span< T >::const_iterator = const_pointer

◆ const_pointer

template<typename T >
using ityr::global_span< T >::const_pointer = ori::global_ptr<std::add_const_t<element_type> >

◆ const_reference

template<typename T >
using ityr::global_span< T >::const_reference = typename std::iterator_traits<const_pointer>::reference

◆ const_reverse_iterator

template<typename T >
using ityr::global_span< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ difference_type

template<typename T >
using ityr::global_span< T >::difference_type = typename std::iterator_traits<pointer>::difference_type

◆ element_type

template<typename T >
using ityr::global_span< T >::element_type = T

◆ iterator

template<typename T >
using ityr::global_span< T >::iterator = pointer

◆ pointer

template<typename T >
using ityr::global_span< T >::pointer = ori::global_ptr<element_type>

◆ reference

template<typename T >
using ityr::global_span< T >::reference = typename std::iterator_traits<pointer>::reference

◆ reverse_iterator

template<typename T >
using ityr::global_span< T >::reverse_iterator = std::reverse_iterator<iterator>

◆ size_type

template<typename T >
using ityr::global_span< T >::size_type = std::size_t

◆ value_type

template<typename T >
using ityr::global_span< T >::value_type = std::remove_cv_t<element_type>

Constructor & Destructor Documentation

◆ global_span() [1/6]

template<typename T >
constexpr ityr::global_span< T >::global_span ( )
inlineconstexprnoexcept

◆ global_span() [2/6]

template<typename T >
template<typename ContiguousIterator >
constexpr ityr::global_span< T >::global_span ( ContiguousIterator  first,
size_type  n 
)
inlineconstexpr

◆ global_span() [3/6]

template<typename T >
template<typename ContiguousIterator >
constexpr ityr::global_span< T >::global_span ( ContiguousIterator  first,
ContiguousIterator  last 
)
inlineconstexpr

◆ global_span() [4/6]

template<typename T >
template<typename R >
constexpr ityr::global_span< T >::global_span ( R &&  r)
inlineconstexpr

◆ global_span() [5/6]

template<typename T >
template<typename U >
constexpr ityr::global_span< T >::global_span ( const global_span< U > &  s)
inlineconstexprnoexcept

◆ global_span() [6/6]

template<typename T >
constexpr ityr::global_span< T >::global_span ( const this_t other)
constexprdefaultnoexcept

Member Function Documentation

◆ back()

template<typename T >
constexpr reference ityr::global_span< T >::back ( ) const
inlineconstexpr

◆ begin()

template<typename T >
constexpr iterator ityr::global_span< T >::begin ( ) const
inlineconstexprnoexcept

◆ cbegin()

template<typename T >
constexpr const_iterator ityr::global_span< T >::cbegin ( ) const
inlineconstexprnoexcept

◆ cend()

template<typename T >
constexpr const_iterator ityr::global_span< T >::cend ( ) const
inlineconstexprnoexcept

◆ crbegin()

template<typename T >
constexpr const_reverse_iterator ityr::global_span< T >::crbegin ( ) const
inlineconstexprnoexcept

◆ crend()

template<typename T >
constexpr const_reverse_iterator ityr::global_span< T >::crend ( ) const
inlineconstexprnoexcept

◆ data()

template<typename T >
constexpr pointer ityr::global_span< T >::data ( ) const
inlineconstexprnoexcept

◆ empty()

template<typename T >
constexpr bool ityr::global_span< T >::empty ( ) const
inlineconstexprnoexcept

◆ end()

template<typename T >
constexpr iterator ityr::global_span< T >::end ( ) const
inlineconstexprnoexcept

◆ front()

template<typename T >
constexpr reference ityr::global_span< T >::front ( ) const
inlineconstexpr

◆ operator=()

template<typename T >
constexpr this_t& ityr::global_span< T >::operator= ( const this_t other)
constexprdefaultnoexcept

◆ operator[]()

template<typename T >
constexpr reference ityr::global_span< T >::operator[] ( size_type  i) const
inlineconstexpr

◆ rbegin()

template<typename T >
constexpr reverse_iterator ityr::global_span< T >::rbegin ( ) const
inlineconstexprnoexcept

◆ rend()

template<typename T >
constexpr reverse_iterator ityr::global_span< T >::rend ( ) const
inlineconstexprnoexcept

◆ size()

template<typename T >
constexpr size_type ityr::global_span< T >::size ( ) const
inlineconstexprnoexcept

◆ subspan()

template<typename T >
constexpr this_t ityr::global_span< T >::subspan ( size_type  offset,
size_type  count 
) const
inlineconstexpr

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