gpt4 book ai didi

c++ - 强制 std::tuple 包含 std::pair

转载 作者:太空狗 更新时间:2023-10-29 20:54:36 24 4
gpt4 key购买 nike

是否可以使用 std::tuple “部分特化”,因此它包含 std::pair<fixed_t, T>有不同的 T?

UPD:元组应该包含对。所以它相当于使用一个数组 fixed_t连同常规 std::tuple .

最佳答案

使用可变模板别名和参数包扩展:

template<typename... Types>
using fixed_tuple = std::tuple< std::pair<fixed_t, Types>... >;

Live example.

关于c++ - 强制 std::tuple 包含 std::pair<fixed_type, T>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38553210/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com