Thread: Can someone help me decipher this: typedef T (*V_FCT_PTR)(T);

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    72

    Can someone help me decipher this: typedef T (*V_FCT_PTR)(T);

    I don't know if this should go in the game coding forum, but it is in reference to image processing/linear algebra, so maybe some of you have seen it.

    This is previously developed code that I'm taking over. The old code was compiled with an old MS VC (6, I believe). I'm using MS VC .NET

    In any case, it's a template class - the code looks a bit like this:
    Code:
    template<typename T>
    class matrix3
    {
    public:
    ...
    	typedef T (*V_FCT_PTR)(T);
    ...
    };
    
    template<typename T>
    matrix3<T>& matrix3<T>::apply(matrix3<T>::V_FCT_PTR fct)  // line 202
    { ... }
    but I'm getting this compile error:
    matrix3.cpp(202): error C2146: syntax error : missing ')' before identifier 'fct'

    Shouldn't 'fct' be a pointer to a function that takes a T as an argument and returns a T? Isn't this proper syntax?

    I don't see the problem.

    Anyone else have an idea?

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    ::sigh:: answered my own question. I guess this MSVC doesn't like the scope resolution before the "V_FCT_PTR"

    I'll leave this up for reference if anyone else comes across something like it.

  3. #3
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    matrix3<T>::V_FCT_PTR fct

    msvc++ .net 2003 is correct here -- that won't work because you are using the matrix3<T> template. You have to use typename when refering to a type nested inside a template defintion (unless you are using a specific instantiation of that template)

    typename matrix3<T>::V_FCT_PTR fct

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    well how 'bout that. You're right. This could be the cause of some of my other headache with this project.

    Looks like I need to read up on templates.

    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  3. Please STICKY this- vital to MSVC 6 dev - BASETSD.h
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 03-15-2005, 09:22 AM
  4. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 07:35 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM