August 2017
Intermediate to advanced
438 pages
14h 19m
English
There is one fundamental difference between boost::fusion::for_each and std::for_each. The std::for_each function contains a loop inside it and determinates at runtime, how many iterations must be done. However, boost::fusion::for_each() knows iterations count at compile time and fully unrolls the loop. For the boost::tuple<cat, int, std::string> tup2, the boost::fusion::for_each(tup2, functor) call is equivalent to the following code:
functor(boost::fusion::at_c<0>(tup2)); functor(boost::fusion::at_c<1>(tup2)); functor(boost::fusion::at_c<2>(tup2));
C++11 contains no Boost.Fusion classes. All the methods of Boost.Fusion are very effective. They do as much as possible at compile time and have some very advanced optimizations. ...
Read now
Unlock full access