小编Pab*_*lín的帖子

boost :: hana tuple解压缩可变参数模板实例化

此问题相关,我想知道使用boost :: hana是否可以直接实现这样的事情:

#include <boost/hana.hpp>
#include <boost/hana/unpack.hpp>

namespace hana = boost::hana;

template<typename ... T>
struct A {};

int main() {

  auto my_tuple = hana::tuple_t<int, double, float>;

  // Is there any way to unpack my_tuple as template arguments for A?
  // Something like
  using MyStruct = A<hana::unpack_types(my_tuple)...>;

  static_assert(std::is_same<MyStruct, A<int, double, float>>::value, "Ooops!");
}
Run Code Online (Sandbox Code Playgroud)

c++ boost c++14 boost-hana

2
推荐指数
1
解决办法
806
查看次数

标签 统计

boost ×1

boost-hana ×1

c++ ×1

c++14 ×1