На cons<First,nil> компиллятор выдаёт ошибку: 37 C:\Dev-Cpp\main.cpp type/value mismatch at argument 2 in template parameter list for `template<class HT, class TT> struct boost::tuples::cons'
Вот код:
#include <iostream>
#include <stdlib.h>
#include <typeinfo>
#include <boost/tuple/tuple.hpp>
using namespace boost;
// choose the larger of two types
template<
typename T1
, typename T2
, bool choose1 = (sizeof(T1) > sizeof(T2)) // hands off!
>
struct choose_larger
{
typedef T1 type;
};
// specialization for the case where sizeof(T2) >= sizeof(T1)
template< typename T1, typename T2 >
struct choose_larger< T1,T2,false >
{
typedef T2 type;
};
// get the largest of a cons-list
template< typename T > struct largest;
// specialization to peel apart the cons list
template< typename First, typename Rest >
struct largest< tuples::cons<First,Rest> >
: choose_larger< First, typename largest<Rest>::type >
{
// type inherited from base
};
// specialization for loop termination
template< typename First >
struct largest< tuples::cons<First,nil> > //Error
{
typedef First type;
};
int main()
{
// print the name of the largest of my_types
std::cout
<< typeid(largest< cons<int, double> >::type).name()
<< std::endl;
system("PAUSE");
return 0;
}
Код взят с
http://www.boost.org/libs/mpl/doc/paper/mpl_paper.pdf страница 5. Как это лечится?
Либо я найду путь, либо проложу его. © Свифт