我試圖使用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