我正在尝试hana::type
使用hana::second
...
namespace hana = boost::hana;
using namespace hana::literals;
struct Key {};
struct Foo {};
int main() {
auto test = hana::make_tuple(
hana::make_pair(
hana::type_c<Key>,
hana::type_c<Foo>));
typename decltype(hana::type_c<Foo>)::type finalTest; //Ok
typename decltype(hana::second(test[0_c]))::type finalTest2; //Error
}
但我收到以下编译器错误:
stacktest.cpp: In function ‘int main()’:
stacktest.cpp:17:12: error: decltype evaluates to ‘boost::hana::type_impl<Foo>::_&’, which is not a class or enumeration type
typename decltype(hana::second(test[0_c]))::type finalTest2;
为什么没有按预期hana::second
返回包含的结果?hana::type