These are chat archives for boostorg/hana

30th
Nov 2015
Maik Klein
@MaikKlein
Nov 30 2015 02:36
what is the equivalent version of hana for std::get<Type>(some_tuple);?
I saw that there is find_if but I don't think it returns a reference
Maik Klein
@MaikKlein
Nov 30 2015 02:47
My workaround was to transform the tuple with ref, filter the tuple to the type that I want and return the value with hana::front
Louis Dionne
@ldionne
Nov 30 2015 03:46
@MaikKlein If you want to index a sequence by keys other than indices, use a hana::set or a hana::map.
Then, std::get<Type>(tuple) will be map[hana::type_c<Type>].
Maik Klein
@MaikKlein
Nov 30 2015 22:30
is there a way to convert between a hana::tuple and std::tuple?
A library that I use outputs pairs and tuples and I want to unpack them with hana::unpack
Louis Dionne
@ldionne
Nov 30 2015 22:50
You can use std::tuple with Hana’s algorithms by including <boost/hana/ext/std/tuple.hpp>, and std::pair by including <boost/hana/ext/std/pair.hpp>. See the documentation section on external adapters.
Otherwise, if you truly need to convert to/from std::tuple, hana::to<hana::ext::std::tuple_tag>(some_hana_tuple) will do the trick. The other way around, hana::to<hana::tuple_tag>(some_std_tuple) should also work.
Maik Klein
@MaikKlein
Nov 30 2015 22:56
Hh damn I missed that part of the docs, thanks that is exactly what I need.
Louis Dionne
@ldionne
Nov 30 2015 23:02
No problem.