9#include "../storage/maybe_storage.hpp"
14template <
typename T, slot_logical_policy Policy = slot_logical_policy::maybe_payload>
16 static_assert(!std::is_void_v<T>,
17 "yorch::detail::typed_slot<T> requires a non-void type");
20 "yorch::detail::typed_slot<T> only supports maybe_payload or must_payload policies");
35 template <
typename...
Args>
37 noexcept(
noexcept(storage_.emplace(std::forward<Args>(
args)...))) {
38 return storage_.emplace(std::forward<Args>(
args)...);
42 return storage_.get();
46 return storage_.get();
54 return storage_.has_value();
58 return reinterpret_cast<std::byte*
>(storage_.raw_ptr());
62 return reinterpret_cast<const std::byte*
>(storage_.raw_ptr());
66 return storage_.engaged_ptr();
70 return storage_.engaged_ptr();
102 static_assert(!std::is_void_v<T>,
103 "yorch::detail::typed_slot<T, must_payload> requires a non-void type");
115 template <
typename...
Args>
117 noexcept(std::is_nothrow_constructible_v<
T,
Args&&...>) {
118 return *std::construct_at(ptr(), std::forward<Args>(
args)...);
130 std::destroy_at(ptr());
151 return std::launder(
reinterpret_cast<T*
>(storage_));
155 return std::launder(
reinterpret_cast<const T*
>(storage_));
159 alignas(
T) std::byte storage_[
sizeof(
T)] {};
slot_physical_policy
Storage-level policy for a physical slot after layout selection.
slot_logical_policy
Node-local slot semantics inferred from a task's result protocol.
constexpr bool is_adapter_descriptor_v
Manual-lifetime storage for an optional in-place T.
constexpr const T & get() const &noexcept
constexpr void destroy() noexcept
constexpr const std::byte * raw_storage() const noexcept
constexpr std::byte * raw_storage() noexcept
static constexpr std::size_t * owner_node_ptr() noexcept
typed_slot & operator=(typed_slot &&)=delete
typed_slot(const typed_slot &)=delete
typed_slot & operator=(const typed_slot &)=delete
constexpr T & emplace(Args &&... args) noexcept(std::is_nothrow_constructible_v< T, Args &&... >)
static constexpr bool * engaged_ptr() noexcept
constexpr T & get() &noexcept
typed_slot(typed_slot &&)=delete
typed_slot & operator=(const typed_slot &)=delete
typed_slot(const typed_slot &)=delete
typed_slot & operator=(typed_slot &&)=delete
constexpr void destroy() noexcept
typed_slot(typed_slot &&)=delete
constexpr bool has_value() const noexcept
constexpr T & get() &noexcept
static constexpr std::size_t * owner_node_ptr() noexcept
constexpr const T & get() const &noexcept
typed_slot & operator=(typed_slot &&)=delete
typed_slot & operator=(const typed_slot &)=delete
typed_slot(const typed_slot &)=delete
constexpr bool * engaged_ptr() noexcept
constexpr std::byte * raw_storage() noexcept
static constexpr slot_physical_policy physical_policy
constexpr T & emplace(Args &&... args) noexcept(noexcept(storage_.emplace(std::forward< Args >(args)...)))
typed_slot(typed_slot &&)=delete
constexpr void destroy() noexcept
constexpr const std::byte * raw_storage() const noexcept
constexpr bool has_value() const noexcept
constexpr const bool * engaged_ptr() const noexcept