Best alternative to a typedef for a function template?

前端 未结 5 1564
你的背包
你的背包 2021-02-07 03:59

What I\'d like to do is something like this:

template 
DataType myFunc(DataType in)
{
   ...
}

typedef myFunc myFunc_i;

myFunc         


        
5条回答
  •  粉色の甜心
    2021-02-07 04:41

    I would make a just tiny improvement over Xeo's answer.

    Instead of using:

    auto const myFunc_i = &myFunc;
    

    I would use

    constexpr auto myFunc_i = &myFunc;
    

提交回复
热议问题