too few template-parameter-lists

K

Kaushal

#include <iostream>

#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>

using namespace std ;
using namespace boost ;

template <typename numericTypes>
struct evalThis
{
void operator()()
{
typedef mpl::find<numericTypes, char>::type iter ; //
ERROR : error: too few template-parameter-lists
}
} ;

int main()
{
typedef mpl::vector<int, float, char, double, long>
myNumericTypes ;

evalThis<myNumericTypes> myObj ;
myObj.operator()() ;

return 0 ;
}
 
S

sean_in_raleigh

// ERROR : error: too few template-parameter-lists
typedef mpl::find<numericTypes, char>::type iter;


It's just another C++ wart: the problem is that
mpl::find<numericTypes, char>::type could be a value
or a type, depending on the template arguments.
The language assumes it's a value, so what you've
got there would be like saying:

struct Person { string name; };
...
typedef Person::name iter;

where name is obviously a value and not a type.

The solution is to explicitly tell the compiler that it's
a type with "typename":

typedef typename mpl::find<numericTypes, char>::type iter ;

You can read more about the issue here:

http://www.comeaucomputing.com/techtalk/templates/#typename

Cheers,
Sean

PS: the previous post asking how the hell mpl::find is defined is
this newsgroup's surprising vernacular for telling you that your
post is off-topic. You might have a friendlier reception
on a Boost mailing list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top