[hana]recursive data type?
How would one define a recursive data type in hana
something described by the type equation:
hana_list<T> = hana::nothing | std::pair
On 06/24/2015 05:25 AM, Larry Evans wrote:
How would one define a recursive data type in hana something described by the type equation:
hana_list<T> = hana::nothing | std::pair
where hana_list<T> is a list of T's terminated by nothing?
I think this: https://gist.github.com/cppljevans/f270db4ddeaf8bdd5733 would be a start.
Larry Evans
On 06/24/2015 05:25 AM, Larry Evans wrote:
How would one define a recursive data type in hana something described by the type equation:
hana_list<T> = hana::nothing | std::pair
where hana_list<T> is a list of T's terminated by nothing?
I think this:
https://gist.github.com/cppljevans/f270db4ddeaf8bdd5733
would be a start.
Sorry for the late reply; you had the time to do it yourself! Indeed, what you wrote would be a good start. Then, you might want to make your List a model of some concepts, like Iterable: namespace boost { namespace hana { // This would require `_const
` to inherit publicly from // `_pair`. template <> struct head_impl<List> { template
participants (2)
-
Larry Evans
-
Louis Dionne