Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:54:11

0001 /*
0002  * SPDX-PackageName: "covfie, a part of the ACTS project"
0003  * SPDX-FileCopyrightText: 2022 CERN
0004  * SPDX-License-Identifier: MPL-2.0
0005  */
0006 
0007 #pragma once
0008 
0009 #include <cstddef>
0010 #include <variant>
0011 
0012 namespace covfie::utility {
0013 template <typename B, std::size_t N, bool = B::is_initial>
0014 struct nth_backend {
0015     using type = typename nth_backend<typename B::backend_t, N - 1>::type;
0016 };
0017 
0018 template <typename B>
0019 struct nth_backend<B, 0, false> {
0020     using type = B;
0021 };
0022 
0023 template <typename B>
0024 struct nth_backend<B, 0, true> {
0025     using type = B;
0026 };
0027 
0028 template <typename B, std::size_t N>
0029 struct nth_backend<B, N, true> {
0030     using type = std::monostate;
0031 };
0032 
0033 template <typename B, bool = B::is_initial>
0034 struct backend_depth {
0035 };
0036 
0037 template <typename B>
0038 struct backend_depth<B, true> {
0039     static constexpr std::size_t value = 1;
0040 };
0041 
0042 template <typename B>
0043 struct backend_depth<B, false> {
0044     static constexpr std::size_t value =
0045         backend_depth<typename B::backend_t>::value + 1;
0046 };
0047 }