boost hana 将两个序列压缩到地图中

boost hana zip two sequences into map

static constexpr auto type_tuple_c = hana::tuple_t<T...>;
static constexpr auto idx_tuple_c = hana::tuple_c<std::size_t, 0, sizeof...(T)>;

我想将这两个大小相等的序列相互映射。但是,我似乎无法理解如何使用 hana::map 功能获得它:

static constexpr auto type_idx_map_c = hana::unpack(
    hana::zip_with(hana::make_pair, type_tuple_c, idx_tuple_c)
  , hana::make_map
);

无论我进行何种转换,我似乎都无法创建映射。我知道地图要求其元素属于 Product 概念,但我似乎无法理解(甚至无法理解)关于压缩结构的行为。

有什么我可以做的,或者我做错了什么吗?

运行 gcc version 6.0.0 20160320hana version 0.7.0 今天最后一次提取

I'd like to map these two sequences of equal sizes with each other.

这些序列通常大小不等。 type_tuple_c 的大小为 sizeof...(T),但 idx_tuple_c 的大小为 2 - 它仅包含元素 hana::size_c<0>hana::size_c<sizeof...(T)>.

我认为就指数而言,您正在寻找的只是 std::make_index_sequence<sizeof...(T)>{}。这应该仍然可以与 Boost.Hana 一起使用。