I\'m trying to iterate over a boost::fusion vector using:
typedef typename fusion::result_of::begin::type t_iter;
std::cout << distance(begi
fusion
is a wonderful library, and you should now that it is really different from what you use in every day C++ programs in multiple ways, it merge the power of compile time meta programming with runtime, for that you should now that there is no type that can handle all items in a fusion
container. What this means? it means that result_of::begin
is not always a match of next(it)
so you can't use fusion
iterators in a for
like that.
The obvious problem in your code is that you ignore return value of next
and it will cause your code to run forever but you can't use it in it = next(it)
, since their type may vary!!
So what you should do?? You should use boost::fusion::for_each
for that purpose