我如何以不同的方式专门化typedef及其隐式类型?

Fri*_*igg 6 c++ templates typedef specialization

我有这样的事情:

typedef int AnotherType;
template <typename T> Func( T Value );

// And I want to specialize these two cases separately:

template <> bool Func<int>( int Value ) {...}
template <> bool Func<AnotherType>( AnotherType Value ) {...}
Run Code Online (Sandbox Code Playgroud)

我真的不需要专门用于int,我真正需要的是为AnotherType执行不同的函数.我无法更改AnotherType或基本函数的定义.

由于SFINAE,重载也无济于事.

Fer*_*cio 2

您可以使用BOOST_STRONG_TYPEDEF