Saturday, February 18, 2017

boost enable_if_c example

Consider the following code adapted from Polukhin's book:


When run:

kuyu@ub16:~/dkuyu/Dropbox/practice/cpp/boost/polukhin/ch04/enable_if_c$ g++ -I~/dkuyu/bin/boost_1_60_0 c.cpp && ./a.out
double data_processor<T, typename boost::enable_if_c<boost::is_integral<T>::value>::type>::process(const T&, const T&, const T&) [with T = int; typename boost::enable_if_c<boost::is_integral<T>::value>::type = void]
double data_processor<T, typename boost::enable_if_c<boost::is_integral<T>::value>::type>::process(const T&, const T&, const T&) [with T = short int; typename boost::enable_if_c<boost::is_integral<T>::value>::type = void]
double data_processor<T, typename boost::enable_if_c<boost::is_float<T>::value>::type>::process(const T&, const T&, const T&) [with T = double; typename boost::enable_if_c<boost::is_float<T>::value>::type = void]
double data_processor<T, typename boost::enable_if_c<boost::is_float<T>::value>::type>::process(const T&, const T&, const T&) [with T = float; typename boost::enable_if_c<boost::is_float<T>::value>::type = void]
double data_processor<T, enable>::process(const T&, const T&, const T&) [with T = const char*; enable = void]

No comments:

Post a Comment