我尝试编译简单的 C++11 代码(我主要针对 vs2010 以及作为次要选项 vs 2012)他们说它应该编译并且可以在一些现代编译器上编译 所以我想知道如何编译包含以下结构的代码:
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 中不可能?