Closed denzor200 closed 2 years ago
Like this:
namespace hana = boost::hana;
template<class D, std::size_t... I> auto to_hana_string_impl( std::index_sequence<I...> )
{
return hana::string_c< D::name[I]... >;
}
template<class D> auto to_hana_string()
{
return to_hana_string_impl<D>( std::make_index_sequence<__builtin_strlen(D::name)>() );
}
(https://godbolt.org/z/G5c51er4W)
It's a bit more complex than it needs to be, but see https://github.com/boostorg/describe/pull/10 for discussion why this is so.
Thanks for the detailed answer!
Is there a way to convert value of
D.name
toboost::hana::string
? https://www.boost.org/doc/libs/1_79_0/libs/hana/doc/html/structboost_1_1hana_1_1string.html If not, is it planned to introduce a similar feature on the Boost Describe side?