These are chat archives for boostorg/hana

8th
Jun 2018
Andreas Borgen Longva
@Andlon
Jun 08 2018 07:40
Hi everybody. I've just discovered Hana, and I have a very basic question. Say I want to iterate over a finite set of types (defined in some header file) and for each type call some function, is this something that it is natural to use Hana for?
Jason Rice
@ricejasonf
Jun 08 2018 17:07

Hello, @Andlon, that is definitely a use case for Hana. Check out the functions associated with the Foldable concept.
http://boostorg.github.io/hana/group__group-Foldable.html

If you want to call a function that performs side effects, then for_each is a good choice. unpack and fold_left are good for returning something but note that, since unpack works with a variadic function, it performs better at compile-time because it doesn't create many intermediate function calls.

Jason Rice
@ricejasonf
Jun 08 2018 17:13
There is also an Iterable concept that adds to Foldable.