Thread: Pointer to templated function

  1. #1
    Registered User Nippashish's Avatar
    Join Date
    Sep 2002
    Posts
    34

    Pointer to templated function

    I need to know the syntax for declaring a pointer to a templated function. More specificly, I need to be able to pass a pointer to a function declared as:

    template <class T>
    int foo(const T&, const T&)

    into a member function of my class.
    I tried:

    typedef template <class T> int (* foo)(const T&, const T&)

    However, that apparently is incorrect.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I've never done this before, but you should remember that a template is only for developing a class, therefore you need to specify the type of "T" whenever you do anything like this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  2. Function Pointer help
    By Skydt in forum C Programming
    Replies: 5
    Last Post: 12-02-2005, 09:13 AM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM