/** * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LIBPANDABASE_SERIALIZER_TUPLE_TO_STRUCT_H #define LIBPANDABASE_SERIALIZER_TUPLE_TO_STRUCT_H #include namespace panda::serializer::internal { template Struct TupleToStructImpl([[maybe_unused]] std::index_sequence is, Tuple &&tup) { return {std::get(std::forward(tup))...}; } template Struct TupleToStruct(Tuple &&tup) { using T = std::remove_reference_t; auto sequence = std::make_index_sequence> {}; return TupleToStructImpl(sequence, std::forward(tup)); } } // namespace panda::serializer::internal #endif // LIBPANDABASE_SERIALIZER_TUPLE_TO_STRUCT_H