kokkos-execution 0.0.1
Loading...
Searching...
No Matches
Kokkos::Execution::Impl::OptionalStorage< T > Class Template Reference

Data structure that has an interface similar to std::optional but stores the value with stdexec::__manual_lifetime. More...

#include <optional_storage.hpp>

Public Member Functions

constexpr OptionalStorage () noexcept=default
constexpr ~OptionalStorage ()
 OptionalStorage (const OptionalStorage &)=delete
 OptionalStorage (OptionalStorage &&)=delete
OptionalStorageoperator= (const OptionalStorage &)=delete
OptionalStorageoperator= (OptionalStorage &&)=delete
template<typename... Args>
constexpr auto emplace (Args &&... args) noexcept(std::is_nothrow_constructible_v< T, Args... >) -> T &
template<typename Func, typename... Args>
constexpr auto emplace_from (Func &&func, Args &&... args) noexcept(noexcept(T{std::forward< Func >(func)(std::forward< Args >(args)...)})) -> T &
constexpr void reset () noexcept
constexpr auto get () &noexcept -> T &
constexpr auto get () const &noexcept -> const T &
constexpr auto get () &&noexcept -> T &&
constexpr auto get () const &&noexcept -> const T &&=delete
constexpr auto operator-> () noexcept -> T *
constexpr auto operator-> () const noexcept -> const T *
constexpr operator bool () const noexcept
constexpr bool has_value () const noexcept

Private Attributes

stdexec::__manual_lifetime< T > m_storage {}
bool m_has_value {false}

Detailed Description

template<typename T>
class Kokkos::Execution::Impl::OptionalStorage< T >

Data structure that has an interface similar to std::optional but stores the value with stdexec::__manual_lifetime.

  1. Similarly to std::optional, the boolean member m_has_value tracks if the storage has been populated or not.
  2. Similarly to std::optional, it will destroy the underlying storage automatically in the destructor if m_has_value is true.
  3. It provides similar storage semantics as stdexec::__manual_lifetime: it is not movable, and can be used as a placeholder storage for types that are not movable, like stdexec operation states. Notably, the member function emplace_from allows in-place construction from the result of a callable.

Definition at line 19 of file optional_storage.hpp.

Constructor & Destructor Documentation

◆ OptionalStorage() [1/3]

template<typename T>
Kokkos::Execution::Impl::OptionalStorage< T >::OptionalStorage ( )
constexprdefaultnoexcept

◆ ~OptionalStorage()

template<typename T>
Kokkos::Execution::Impl::OptionalStorage< T >::~OptionalStorage ( )
inlineconstexpr

Definition at line 23 of file optional_storage.hpp.

References m_has_value, m_storage, and OptionalStorage().

◆ OptionalStorage() [2/3]

template<typename T>
Kokkos::Execution::Impl::OptionalStorage< T >::OptionalStorage ( const OptionalStorage< T > & )
delete

References OptionalStorage().

◆ OptionalStorage() [3/3]

template<typename T>
Kokkos::Execution::Impl::OptionalStorage< T >::OptionalStorage ( OptionalStorage< T > && )
delete

References OptionalStorage().

Member Function Documentation

◆ emplace()

template<typename T>
template<typename... Args>
auto Kokkos::Execution::Impl::OptionalStorage< T >::emplace ( Args &&... args) ->T &
inlineconstexprnoexcept

Definition at line 35 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ emplace_from()

template<typename T>
template<typename Func, typename... Args>
auto Kokkos::Execution::Impl::OptionalStorage< T >::emplace_from ( Func && func,
Args &&... args )->T &
inlineconstexprnoexcept

Definition at line 43 of file optional_storage.hpp.

◆ get() [1/4]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::get ( ) &&->T &&
inlineconstexprnoexcept

Definition at line 67 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ get() [2/4]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::get ( ) &->T &
inlineconstexprnoexcept

Definition at line 57 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ get() [3/4]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::get ( ) const &&->constT &&=delete
constexprdeletenoexcept

◆ get() [4/4]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::get ( ) const &->constT &
inlineconstexprnoexcept

Definition at line 62 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ has_value()

template<typename T>
bool Kokkos::Execution::Impl::OptionalStorage< T >::has_value ( ) const
inlineconstexprnoexcept

Definition at line 88 of file optional_storage.hpp.

References m_has_value.

◆ operator bool()

template<typename T>
Kokkos::Execution::Impl::OptionalStorage< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Definition at line 84 of file optional_storage.hpp.

References m_has_value.

◆ operator->() [1/2]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::operator-> ( ) const->constT *
inlineconstexprnoexcept

Definition at line 79 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ operator->() [2/2]

template<typename T>
auto Kokkos::Execution::Impl::OptionalStorage< T >::operator-> ( ) ->T *
inlineconstexprnoexcept

Definition at line 74 of file optional_storage.hpp.

References m_has_value, and m_storage.

◆ operator=() [1/2]

template<typename T>
OptionalStorage & Kokkos::Execution::Impl::OptionalStorage< T >::operator= ( const OptionalStorage< T > & )
delete

References OptionalStorage().

◆ operator=() [2/2]

template<typename T>
OptionalStorage & Kokkos::Execution::Impl::OptionalStorage< T >::operator= ( OptionalStorage< T > && )
delete

References OptionalStorage().

◆ reset()

template<typename T>
void Kokkos::Execution::Impl::OptionalStorage< T >::reset ( )
inlineconstexprnoexcept

Definition at line 51 of file optional_storage.hpp.

References m_has_value, and m_storage.

Member Data Documentation

◆ m_has_value

template<typename T>
bool Kokkos::Execution::Impl::OptionalStorage< T >::m_has_value {false}
private

Definition at line 94 of file optional_storage.hpp.

◆ m_storage

template<typename T>
stdexec::__manual_lifetime<T> Kokkos::Execution::Impl::OptionalStorage< T >::m_storage {}
private

Definition at line 93 of file optional_storage.hpp.


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