Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > too few template-parameter-lists

Reply
Thread Tools

too few template-parameter-lists

 
 
Kaushal
Guest
Posts: n/a
 
      11-18-2008

#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 ;
}
 
Reply With Quote
 
 
 
 
sean_in_raleigh@yahoo.com
Guest
Posts: n/a
 
      11-18-2008
On Nov 18, 1:13 pm, Kaushal <(E-Mail Removed)> wrote:
[...]
> // 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/techt...ates/#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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet connects for a few seconds then disconnects for a few sec Cody Wireless Networking 2 06-28-2009 08:24 PM
Too few parameters. Expected 2 geletine Java 3 05-22-2006 05:46 PM
To delete few lines and add few lines at the end of a text file using c program Murali C++ 2 03-09-2006 04:45 PM
SQL Exception: Too few parameters..... Aaron B. Java 2 11-23-2004 12:59 PM
power connectors - too few? Johnny8977 Computer Support 10 09-09-2004 06:23 PM



Advertisments