Template class methods definition with enable_if as template parameter

前端 未结 2 1446
天涯浪人
天涯浪人 2021-02-05 22:07

I asked this question earlier where a solution was presented. The solution is great as far as the question is concerned, but now I am confused on how I would define the methods

2条回答
  •  忘了有多久
    2021-02-05 22:32

    From the looks of it, you want to do something along the lines of this:

    template ::value>::type >
    struct Foo;
    
    template 
    struct Foo {
        Foo();
    };
    
    template 
    Foo::Foo() {
    }
    

    This sneakily takes advantage of the default argument in a few places: don't get confused, there is an implicit void sitting in several locations.

提交回复
热议问题