August 2017
Intermediate to advanced
438 pages
14h 19m
English
The most interesting part here is that boost::mpl::int_<sizeof(T)>(). sizeof(T) executes at compile time, so its output can be used as a template parameter. The class boost::mpl::int_<> is just an empty class that holds a compile-time value of integral type. In the Boost.MPL library, such classes are called integral constants. It can be implemented as shown in the following code:
template <int Value> struct int_ { static const int value = Value; typedef int_<Value> type; typedef int value_type; };
We need an instance of this class, which is why we have a round parentheses at the end of boost::mpl::int_<sizeof(T)>().
Now, let's take a closer look at how the compiler will decide which process_impl function to use. First of ...
Read now
Unlock full access