【问题标题】:Forcing std::tuple to contain std::pair<fixed_type, T>强制 std::tuple 包含 std::pair<fixed_type, T>
【发布时间】:2016-07-24 14:37:20
【问题描述】:

是否可以使用std::tuple“部分特化”以使其包含具有不同T 的std::pair&lt;fixed_t, T&gt;

UPD:元组应该包含对。所以它相当于使用fixed_t 的数组和一个普通的std::tuple

【问题讨论】:

    标签: c++ stdtuple


    【解决方案1】:

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

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

    Live example.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-07
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      • 2021-03-17
      • 2019-08-11
      • 2023-02-16
      • 1970-01-01
      相关资源
      最近更新 更多