template<typename T> asge::concurrent::ContextWithValue
A context that carries an immutable typed value alongside cancellation.
#include <Context.hpp>Inherits from asge::concurrent::Context.
Inheritance
classDiagram
class N2["asge::concurrent::Context"]
class N1["asge::concurrent::ContextWithValue"]
class N3["asge::concurrent::_internal::IContext"]
class N4["std::enable_shared_from_this"]
N3 <|-- N2
N4 <|-- N2
N2 <|-- N1
click N2 href "classasge_1_1concurrent_1_1Context.html"
click N1 href "classasge_1_1concurrent_1_1ContextWithValue.html"
click N3 href "structasge_1_1concurrent_1_1__internal_1_1IContext.html"
Collaboration
classDiagram
class N2["asge::concurrent::Context"]
class N1["asge::concurrent::ContextWithValue"]
class N5["asge::concurrent::_internal::CancelState"]
class N3["asge::concurrent::_internal::IContext"]
class N4["std::enable_shared_from_this"]
N3 <|-- N2
N4 <|-- N2
N2 --> N5 : m_State
N2 <|-- N1
click N2 href "classasge_1_1concurrent_1_1Context.html"
click N1 href "classasge_1_1concurrent_1_1ContextWithValue.html"
click N5 href "structasge_1_1concurrent_1_1__internal_1_1CancelState.html"
click N3 href "structasge_1_1concurrent_1_1__internal_1_1IContext.html"
ContextWithValue extends Context with a single value of type T that is set at construction and never changes. It inherits the full cancellation and tree propagation behaviour of Context — cancelling it behaves identically to cancelling a plain Context.
Created exclusively through WithValue(), never constructed directly.
T | Type of the value carried by this context. Must be move-constructible. |
Public Types
using value_type = Tusing const_reference = T const &using pointer = std::shared_ptr< ContextWithValue< T > >Private Attributes
Private Member Functions
Public Member Functions
const_reference Value() const noexceptFriends
friend WithValueDerives a child context that carries an immutable typed value.
Creates a new ContextWithValue<T> as a child of the given parent, attaching it to the context tree. If the parent is already cancelled at the time of this call, the child is cancelled immediately with the same error. Otherwise the child is registered with the parent and will be cancelled automatically when the parent is.
T | Type of the value to carry. Must be move-constructible. |
inValue | The value to attach to the context. |
inParent | The parent context (nullptr by default). |