C++ templates specialization syntax

后端 未结 2 1391
猫巷女王i
猫巷女王i 2020-11-28 03:00

In C++ Primer Plus (2001, Czech Translation) I have found these different template specialization syntax:

function template

template         


        
2条回答
  •  甜味超标
    2020-11-28 03:15

    Using Visual Studio 2012, it seems to work slightly different if there's no function argument:

    template  T bar( );
    //template int bar( ) { return 0; } doesn't work
    template < > int bar( ) { return 0; } //does work
    

提交回复
热议问题