Thread: Explicit specialisation of function template as member of class template

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2008
    Location
    Paris
    Posts
    248

    Explicit specialisation of function template as member of class template

    Hi,

    How on earth do I explicitely specialize :
    Code:
    template<typename U>
    class A {
    public:
      template<typename T> void f(T& v)
      {
        // do something in general with u_
      }
      U u_;
    };
    this doesn't work :
    Code:
    template<>
    void A<int> :: f<double> (double& v) {
    // do something special with int
    }
    Thanks !!
    Last edited by MarkZWEERS; 01-30-2011 at 04:19 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling base class function when base is a template
    By VirtualAce in forum C++ Programming
    Replies: 9
    Last Post: 07-11-2010, 02:26 AM
  2. Threading A Member Function For Templated Class
    By scwizzo in forum C++ Programming
    Replies: 12
    Last Post: 01-21-2010, 02:37 AM
  3. Default class template problem
    By Elysia in forum C++ Programming
    Replies: 5
    Last Post: 07-11-2008, 08:44 AM
  4. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM