template specialization for static member functions; howto?

后端 未结 5 890
情歌与酒
情歌与酒 2021-02-05 19:03

I am trying to implement a template function with handles void differently using template specialization.

The following code gives me an \"Explicit specialization in non

5条回答
  •  情话喂你
    2021-02-05 19:20

    You can declare the explicit specialisation in the same way you'd define a member function outside of its class:

    class A
    {
    public:
      template 
      static void foo () {}
    };
    
    template <>
    void A::foo ()
    {
    }
    

提交回复
热议问题