C++ Visual Studio 10到Visual Studio 13中的模板更改

Zac*_*art 5 c++ templates visual-studio-2010 visual-studio-2013

我会尝试尽可能短,而不会在代码上重载.如果您想要更多代码,请发表评论.

我遇到了与模板相关的一些代码行的编译器错误.此代码是在2005年编写的,但在Visual Studio 2010中继续有效.升级到VS2013时,它不再有效.

有错误的行是

typedef typename LookupPow<POW - 1>::Evaluate<Pow_impl<ROOT, POW - 1 >> ::Value Next;
Run Code Online (Sandbox Code Playgroud)

似乎是<after Evaluate之后的问题,编译器给出了

error C2059: syntax error : '<' 
Run Code Online (Sandbox Code Playgroud)

编写幂函数似乎是一种复杂的方法,使得它在编译时而不是运行时进行求值.

该行位于此代码块中

template <int ROOT, int POW>
struct Pow_impl
{
/// <summary>
/// The next recursive type to use to calculate the exponent
/// This will count down from POW to 0 each time multiplying ROOT to the current value
/// </summary>
typedef typename LookupPow<POW - 1>::Evaluate<  Pow_impl<ROOT, POW - 1 >> ::Value Next;

/// <summary>
/// Recursively calculate the next exponent
/// POW will recursively count down from the value originally used to 0
/// This effectively multiplies ROOT together POW times
/// </summary>
enum { Value = ROOT * Next::Value };
};
Run Code Online (Sandbox Code Playgroud)

评估中定义了评估

template <int CNT>
struct LookupPow
{
/// <summary>
/// For the base case, just provide the template parameter as the typedef Value
/// </summary>
template <typename T>
struct Evaluate
{
    /// <summary>
    /// The Evaluate meta-function return value. This matches the template parameter
    /// </summary>
    typedef T Value;
};

};
Run Code Online (Sandbox Code Playgroud)

还有基本案例LookupPow模板,我没有包含它.

任何建议都会非常有用.