【问题标题】:Expanding boost preprocessor sequence to std::tuple将 boost 预处理器序列扩展到 std::tuple
【发布时间】:2021-06-13 12:41:27
【问题描述】:

如果我有一个 boost 预处理器序列宏,例如:

#define BOOST_PP_SEQUENCE\
    (float)\
    (int)\
    (bool)\

是否可以将此元组转换为 std::tuple?我想把它转换成类似的东西:

using RealTuple = ...  //resulting in std::tuple<float, int, bool>

【问题讨论】:

标签: c++ boost macros


【解决方案1】:

答案是:

using Tuple = std::tuple<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQUENCE)>;

【讨论】:

    猜你喜欢
    • 2013-03-18
    • 2018-05-06
    • 1970-01-01
    • 2015-02-20
    • 2018-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多