
6 Jul
2015
6 Jul
'15
6:53 p.m.
Uthpal Urubail <uthpal.urubail <at> altair.com> writes:
Experts, What is the best way to iterator over boost::tuple and return value? Example: For(int i=0;i<boost::tuples::length<T>::value;i++) { Boost_tuple_example.get<i>(); } Regards, UJ
If you're in C++14, Hana to the rescue! ------------------------------------------------------------------------------ #include <boost/hana/tuple.hpp> #include <string> namespace hana = boost::hana; int main() { auto xs = hana::make_tuple(1, 'x', std::string{"foobar"}); hana::for_each(xs, [](auto x) { // use x }); } ------------------------------------------------------------------------------ Regards, Louis