The error message states that the decltype is evaluating to boost::hana::type_impl<Foo>::_&
, which while a little cryptic looking, you can see by the &
at the end that it is a reference to the contained hana::type
. Unfortunately the reference will not contain the members that you expect to find in the raw type.
For this hana::type
provides a unary operator+
that simply dereferences to the raw type so you can do the following:
typename decltype(+hana::second(test[0_c]))::type finalTest2;
hana::typeid_
works for this as well as it idempotently wraps any value in a hana::type
with const and reference qualifiers stripped:
typename decltype(hana::typeid_(hana::second(test[0_c])))::type finalTest2;
It's worth noting that all of the following Hana functions return references:
first
, second
, at
, at_key
, and associated operator[]
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…