I discovered two months ago boost::hana. Seems very powerfull so I decided to take a look. From the documentation I saw this examples:
std::string s;
hana::int_c<10>.times([&]{ s += "x"; });
that is equivalent to:
s += "x"; s += "x"; ... s += "x"; // 10 times
I'd like to know if it is possible (and if yes how) to write smthg like:
std::string s;
std::array<int, 10> xs = {1, 3, 5, ...};
hana::int_c<10>.times([&](int i){ s += std::to_string(xs[i]) + ","; });
a sort of "unpacking" at compile time, or even:
myfunction( hana::unpack<...>( xs ) );
Aucun commentaire:
Enregistrer un commentaire