9#include "../../assert.hpp"
25 static_assert(!std::is_void_v<T>,
26 "yorch::detail::slot_view<T> requires a non-void type");
44 template <
typename Slot>
45 requires (!std::is_same_v<std::remove_cvref_t<Slot>,
slot_view>)
51 policy(Slot::physical_policy) {}
55 template <
typename...
Args>
57 noexcept(std::is_nothrow_constructible_v<
T,
Args&&...>) {
60 "yorch::detail::slot_view<T> maybe_payload slots require an engagement flag");
62 "yorch::detail::slot_view<T>::emplace() called on a live value");
63 auto*
object = std::construct_at(ptr(), std::forward<Args>(
args)...);
71 auto*
object = std::construct_at(ptr(), std::forward<Args>(
args)...);
81 "yorch::detail::slot_view<T>::get() called on an empty value");
90 "yorch::detail::slot_view<T>::get() called on an empty value");
102 std::destroy_at(ptr());
110 std::destroy_at(ptr());
124 return std::launder(
reinterpret_cast<T*
>(
storage));
128 return std::launder(
reinterpret_cast<const T*
>(
storage));
#define YORCH_ASSERT(condition)
constexpr std::size_t no_physical_slot
Sentinel physical slot index meaning "this node has no storage".
slot_physical_policy
Storage-level policy for a physical slot after layout selection.
constexpr bool is_adapter_descriptor_v
Non-owning typed access view over a slot-like storage object.
constexpr const T & get() const &noexcept
constexpr slot_view(Slot &slot, std::size_t owner_node=no_physical_slot) noexcept
Creates a typed view over slot.
slot_physical_policy policy
std::size_t * slot_owner_node
constexpr void destroy() noexcept
constexpr bool has_value() const noexcept
constexpr T & get() &noexcept
constexpr T & emplace(Args &&... args) noexcept(std::is_nothrow_constructible_v< T, Args &&... >)
std::size_t view_owner_node