fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. #include <boost/mpl/fold.hpp>
  5. #include <boost/mpl/plus.hpp>
  6. #include <boost/mpl/vector.hpp>
  7. #include <boost/type_traits.hpp>
  8.  
  9. using namespace std;
  10. using namespace boost;
  11. using namespace boost::mpl;
  12. using namespace boost::type_traits;
  13.  
  14. typedef vector<long,float,short,double,float,long,long double> types;
  15. typedef fold<
  16. types
  17. , int_<0>
  18. , if_< is_float<_2>,next<_1>,_1 >
  19. >::type number_of_floats;
  20.  
  21. BOOST_MPL_ASSERT_RELATION( number_of_floats::value, ==, 4 );
  22.  
  23. int main(){
  24. }
  25.  
Success #stdin #stdout 0.02s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty