0

我尝试编译simple C++11 code(我primaraly目标VS2010,也可以作为第二选择VS 2012)they say它应当编制,is compilable on some modern compilers 所以我不知道如何编译包含的代码结构,如:VS2010和VS2012和C++ 11错误C2059:语法错误:'...'如何避开?

struct C { 
    A *_first__; 
    B *_second__; 
    C(A * _first__, B * _second__):_first__(_first__), _second__(_second__) { 
    } template < typename K, typename ... T > static auto _a_caller__(K * k, T && ... args)->decltype(k->a(std::forward <T> (args) ...)) { 
    return k->a(std::forward <T> (args)...); 
    } 
    template <typename...T> auto a(T &&...args)->decltype(_a_caller__(_first__, std::forward <T> (args)...)) { 
     return _a_caller__(_first__, std::forward <T> (args)...); 
    } 
    template <typename...T> auto a(T &&...args)->decltype(_a_caller__(_second__, std::forward <T> (args)...)) { 
     return _a_caller__(_second__, std::forward <T> (args)...); 
    } 
    template < typename K, typename...T > static auto _b_caller__(K * k, T && ... args)->decltype(k->b(std::forward <T> (args) ...)) { 
     return k->b(std::forward <T> (args)...); 
    } 
    template <typename...T> auto b(T &&...args)->decltype(_b_caller__(_first__, std::forward <T> (args)...)) { 
     return _b_caller__(_first__, std::forward <T> (args)...); 
    } 
    template <typename...T> auto b(T &&...args)->decltype(_b_caller__(_second__, std::forward <T> (args)...)) { 
     return _b_caller__(_second__, std::forward <T> (args)...); 
    } 
}; 

在VS 2010和如果在vs2012中不可能呢?

回答

4
+0

好吧,它钢铁不编译即使与VS 2012(Visual C++ 2012年11月CTP)中的变量模板 – myWallJSON

+0

([退出在线编译器版本](http://rise4fun.com/Vcpp/hBV)) – myWallJSON

+0

也不我可以在VS2012更新之后编译这样的代码1 – myWallJSON

相关问题