boostorg / hana

Your standard library for metaprogramming
http://boostorg.github.io/hana
Boost Software License 1.0
1.7k stars 216 forks source link

Is it possible to get back the C++ type from hana::type? #513

Closed Kelvinyu1117 closed 1 year ago

Kelvinyu1117 commented 1 year ago

Hi everyone, I'm new to hana and I want to play around with some metaprogramming magic with hana.

Is there any function that allows me to convert hana::type<T> back to T?

ricejasonf commented 1 year ago

The simplest, most common way to access the contained type is via the type member: typename some_type::type. Other techniques may involve type deduction, and there is also the Metafunction concept which provides a few functions for applying types to templates in various ways.

Be sure to check out the "Lvalues and Rvalues" section under the documentation for type. http://boostorg.github.io/hana/structboost_1_1hana_1_1type.html