Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:12: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 <utility>
0010 
0011 #include <covfie/core/parameter_pack.hpp>
0012 
0013 namespace covfie::utility {
0014 /**
0015  * @brief Build the owning data of a backend from a parameter pack.
0016  *
0017  * The head of the pack configures the outermost layer. If a tail remains, it
0018  * builds the child of that layer, which the layer then takes ownership of. If
0019  * no tail remains, the layer builds its own child from its own configuration.
0020  */
0021 template <typename B, typename C, typename... Cs>
0022 typename B::owning_data_t construct(parameter_pack<C, Cs...> && p)
0023 {
0024     if constexpr (sizeof...(Cs) == 0) {
0025         return typename B::owning_data_t(std::move(p.x));
0026     } else {
0027         return typename B::owning_data_t(
0028             std::move(p.x), construct<typename B::backend_t>(std::move(p.xs))
0029         );
0030     }
0031 }
0032 }