YOrch 1.0.0
Loading...
Searching...
No Matches
builder_storage_base.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <tuple>
5#include <utility>
6
7#include "metadata.hpp"
8
9namespace yorch::detail {
10
11template <typename Derived, typename... Nodes>
13 using tuple_type = std::tuple<Nodes...>;
14
16
17 static constexpr std::size_t node_count = sizeof...(Nodes);
18 static constexpr std::size_t max_level = detail::max_level_v<Nodes...>;
19
20 template <std::size_t I>
21 using node_type = std::tuple_element_t<I, tuple_type>;
22
23 template <std::size_t I>
24 [[nodiscard]] constexpr auto& entry() & noexcept {
25 return std::get<I>(nodes);
26 }
27
28 template <std::size_t I>
29 [[nodiscard]] constexpr const auto& entry() const& noexcept {
30 return std::get<I>(nodes);
31 }
32
33 template <std::size_t I>
34 [[nodiscard]] constexpr auto&& entry() && noexcept {
35 return std::get<I>(std::move(nodes));
36 }
37};
38
39} // namespace yorch::detail
constexpr std::size_t max_level_v
Definition metadata.hpp:42
constexpr bool is_adapter_descriptor_v
Definition adapters.hpp:63
constexpr const auto & entry() const &noexcept
constexpr auto && entry() &&noexcept
std::tuple_element_t< I, tuple_type > node_type
static constexpr std::size_t node_count