c++17boost-hana

how do I check if a struct has BOOST_HANA_ADAPT_STRUCT in a template?


I have a template which should only apply for a type that is defined with BOOST_HANA_DEFINE_STRUCT or has adapt by BOOST_HANA_ADAPT_STRUCT. Something like following:

template <typename T>
std::enable_if_t<is_hana_struct<T>::value, void>
myfunc(T x)
{
}

How do I implement the is_hana_struct?


Solution

  • I think you're looking for hana::Struct<T>::value: http://boostorg.github.io/hana/group__group-_struct.html