too few template-parameter-lists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kaushal

    too few template-parameter-lists


    #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<numer icTypes, char>::type iter ; //
    ERROR : error: too few template-parameter-lists
    }
    } ;

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

    evalThis<myNume ricTypesmyObj ;
    myObj.operator( )() ;

    return 0 ;
    }
  • Victor Bazarov

    #2
    Re: too few template-parameter-lists

    Kaushal wrote:
    #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<numer icTypes, char>::type iter ; //
    ERROR : error: too few template-parameter-lists
    WTH is 'mpl::find'? How is it defined?
    }
    } ;
    >
    int main()
    {
    typedef mpl::vector<int , float, char, double, long>
    myNumericTypes ;
    >
    evalThis<myNume ricTypesmyObj ;
    myObj.operator( )() ;
    >
    return 0 ;
    }
    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask

    Comment

    • sean_in_raleigh@yahoo.com

      #3
      Re: too few template-parameter-lists

      On Nov 18, 1:13 pm, Kaushal <kausha...@gmai l.comwrote:
      [...]
      // ERROR : error: too few template-parameter-lists
      typedef mpl::find<numer icTypes, char>::type iter;

      It's just another C++ wart: the problem is that
      mpl::find<numer icTypes, 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<numer icTypes, char>::type iter ;

      You can read more about the issue here:



      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.

      Comment

      Working...