状态的Boost.Hana 文档tuple_c
:
另请注意,返回的对象类型
tuple_c
和等效调用make<tuple_tag>
可能不同。
后跟以下代码段:
BOOST_HANA_CONSTANT_CHECK(
hana::to_tuple(hana::tuple_c<int, 0, 1, 2>)
==
hana::make_tuple(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>)
);
然而,实际的实现只是tuple_c
:
#ifdef BOOST_HANA_DOXYGEN_INVOKED
template <typename T, T ...v>
constexpr implementation_defined tuple_c{};
#else
template <typename T, T ...v>
constexpr hana::tuple<hana::integral_constant<T, v>...> tuple_c{};
#endif
to_tuple
而且,事实上,代码片段在没有包装器的情况下工作得很好:
BOOST_HANA_CONSTANT_CHECK(
hana::tuple_c<int, 0, 1, 2>
==
hana::make_tuple(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>)
);
问题:为什么要tuple_c
定义实际的实现类型?包装不是to_tuple
多余的吗?