diff --git a/src/ll/api/base/Alias.h b/src/ll/api/base/Alias.h index 8f956728b5..9736896cc4 100644 --- a/src/ll/api/base/Alias.h +++ b/src/ll/api/base/Alias.h @@ -1,5 +1,10 @@ #pragma once +#include +#include +#include +#include + namespace ll { template struct CArray { @@ -11,4 +16,27 @@ struct CArray { }; template using CArrayT = typename CArray::type; + +template +struct UntypedStorage { + alignas(Align) std::byte data[Len]; + + template + [[nodiscard]] T& as() & { + return *reinterpret_cast(this); + } + template + [[nodiscard]] T const& as() const& { + return *reinterpret_cast(this); + } + template + [[nodiscard]] T&& as() && { + return std::move(*reinterpret_cast(this)); + } + template + [[nodiscard]] T const&& as() const&& { + return std::move(*reinterpret_cast(this)); + } +}; + } // namespace ll diff --git a/src/ll/api/coro/Generator.h b/src/ll/api/coro/Generator.h index ba5a61a940..7dec1a7990 100644 --- a/src/ll/api/coro/Generator.h +++ b/src/ll/api/coro/Generator.h @@ -12,7 +12,7 @@ template struct Generator { using value = std::remove_cvref_t; using reference = T&&; - using yielded = std::conditional_t, reference, reference const&>; + using yielded = reference; struct promise_type { @@ -60,8 +60,8 @@ struct Generator { struct iterator { using iterator_category = std::input_iterator_tag; using difference_type = ptrdiff_t; - using value_type = value; - using reference = reference; + using value_type = Generator::value; + using reference = Generator::reference; using pointer = std::add_pointer_t; std::coroutine_handle handle = nullptr;