C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::Poll< T > Class Template Reference

Overview

template<typename T>
class pw::async2::Poll< T >

A value that may or may not be ready yet.

Poll<T> most commonly appears as the return type of an function that checks the current status of an asynchronous operation. If the operation has completed, it returns with Ready(value). Otherwise, it returns Pending to indicate that the operations has not yet completed, and the caller should try again in the future.

Poll<T> is just data and does not change on its own. To check the current status of an operation, the caller must invoke the Poll<T> returning function again and examine the newly returned Poll<T>.

Public Types

using value_type = T
 

Public Member Functions

 Poll ()=delete
 Basic constructors.
 
constexpr Poll (const Poll &)=default
 
constexpr Polloperator= (const Poll &)=default
 
constexpr Poll (Poll &&)=default
 
constexpr Polloperator= (Poll &&)=default
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, const U & > = 0>
constexpr Poll (const Poll< U > &other)
 
template<typename U , internal_poll::EnableIfExplicitlyConvertible< value_type, const U & > = 0>
constexpr Poll (const Poll< U > &other)
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, U && > = 0>
constexpr Poll (Poll< U > &&other)
 
template<typename U , internal_poll::EnableIfExplicitlyConvertible< value_type, U && > = 0>
constexpr Poll (Poll< U > &&other)
 
template<typename U = value_type, internal_poll::EnableIfImplicitlyInitializable< value_type, U > = 0>
constexpr Poll (U &&u)
 
template<typename U = value_type, internal_poll::EnableIfExplicitlyInitializable< value_type, U > = 0>
constexpr Poll (U &&u)
 
template<typename... Args>
constexpr Poll (std::in_place_t, Args &&... args)
 
constexpr Poll (value_type &&value)
 
constexpr Polloperator= (value_type &&value)
 
constexpr Poll (PendingType) noexcept
 
constexpr Polloperator= (PendingType) noexcept
 
constexpr bool IsReady () const noexcept
 Returns whether or not this value is Ready.
 
constexpr bool IsPending () const noexcept
 Returns whether or not this value is Pending.
 
constexpr Poll Readiness () const noexcept
 
constexpr value_type & value () &noexcept
 
constexpr const value_type & value () const &noexcept
 
constexpr value_type && value () &&noexcept
 
constexpr const value_type && value () const &&noexcept
 
constexpr const value_type * operator-> () const noexcept
 
constexpr value_type * operator-> () noexcept
 
constexpr const value_type & operator* () const &noexcept
 
constexpr value_type & operator* () &noexcept
 
constexpr const value_type && operator* () const &&noexcept
 
constexpr value_type && operator* () &&noexcept
 
constexpr void IgnorePoll () const
 

Constructor & Destructor Documentation

◆ Poll()

template<typename T >
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, const U & > = 0>
constexpr pw::async2::Poll< T >::Poll ( const Poll< U > &  other)
inlineconstexpr

Constructs a new Poll<T> from a Poll<U> where T is constructible from U.

To avoid ambiguity, this constructor is disabled if T is also constructible from Poll<U>.

This constructor is explicit if and only if the corresponding construction of T from U is explicit.

Member Function Documentation

◆ IgnorePoll()

template<typename T >
constexpr void pw::async2::Poll< T >::IgnorePoll ( ) const
inlineconstexpr

Ignores the Poll value.

This method does nothing except prevent no_discard or unused variable warnings from firing.

◆ operator*()

template<typename T >
constexpr const value_type & pw::async2::Poll< T >::operator* ( ) const &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.

◆ operator->()

template<typename T >
constexpr const value_type * pw::async2::Poll< T >::operator-> ( ) const
inlineconstexprnoexcept

Accesses the inner value.

This must only be called if IsReady() returned true.

◆ Readiness()

template<typename T >
constexpr Poll pw::async2::Poll< T >::Readiness ( ) const
inlineconstexprnoexcept

Returns a Poll<> without the inner value whose readiness matches that of this.

◆ value()

template<typename T >
constexpr value_type & pw::async2::Poll< T >::value ( ) &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.


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