我试图使用hana::second
一对访问hana::type
...花::第二不能推断类型
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
?
因为这是堆栈溢出而不是什么应用程序 - 请在您的标题中更正式,并删除不合适的语言,如“_wtf_” –
您能否粘贴错误消息并告诉我们您期望的结果是什么? – Roberto
你会得到什么错误? 'boost :: tuple'是否有'operator []'? – NathanOliver