template typedef as return type

Discussion in 'C++' started by Robert A. T. Kaldy, Jul 9, 2003.

  1. Hello,

    consider a class with a member function:

    template<class schema>
    class A
    {
    schema::t func();
    };

    template<class schema>
    schema::t A<schema>::func()
    { .... }

    The 't' is a type, which will be defined via typedef later, in the schema
    class.
    It takes the error
    'f': unable to resolve function overload
    (I compiled it with VC++ 5.0)
    Putting "typename schema" or "typename schema::t" in the declaration of A
    didn't solved it.
    Any ideas?

    Robert-Antonio

    --------------------------------------------------------
    To obtain my real email address, please remove the
    'w' letter from it :)
    --------------------------------------------------------
    Robert A. T. Kaldy, Jul 9, 2003
    #1
    1. Advertising

  2. "Robert A. T. Kaldy" <> wrote in message
    news:p...
    > Hello,
    >
    > consider a class with a member function:
    >
    > template<class schema>
    > class A
    > {
    > schema::t func();
    > };
    >
    > template<class schema>
    > schema::t A<schema>::func()
    > { .... }
    >
    > The 't' is a type, which will be defined via typedef later, in the schema
    > class.

    No, it is not. It is not a type but the object name. If you need to make a
    compiler to treat it as a type you shall use "typename" qualifier.

    > It takes the error
    > 'f': unable to resolve function overload
    > (I compiled it with VC++ 5.0)

    Just a casual remark: I suspect you are going to have a lot of C++ language
    problems with this pretty old compiler.

    --
    With regards,
    Michael Kochetkov.
    Michael Kochetkov, Jul 9, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    463
    Victor Bazarov
    Nov 19, 2004
  2. Pete Becker
    Replies:
    5
    Views:
    1,012
    =?iso-8859-1?Q?Ali_=C7ehreli?=
    Nov 19, 2004
  3. Replies:
    2
    Views:
    430
    Aleksey Loginov
    Nov 7, 2005
  4. oor
    Replies:
    0
    Views:
    1,343
  5. Adrian
    Replies:
    8
    Views:
    3,302
    James Kanze
    Jan 9, 2009
Loading...

Share This Page