I wonder why, in this code, the type of i is an empty optional.
auto t = boost::hana::make_tuple(boost::hana::type_c<int>, boost::hana::type_c<double>);
auto i = boost::hana::index_if(t, boost::hana::is_a<boost::hana::type<double>>);
To me, it should be optional<hana::size_t<1>>
I know there is Boost hana get index of first matching but it is not exactly the same question
boost::hana::is_areturns whether the tag of an object matches a given tag. [reference]You're not passing it a tag, you're passing it a
hana::typeinstead.For example, you could test whether the argument is a
hana::type, andiwould contain asize_c<0>(because the first item in the tuple is already ahana::type):If you want to check for equality to some type, use
equal::to:[Reference to hana::equal]
Live example