[This answer has been updated. See EDIT at end of text]
I brought this to SSCCE :
#include <iostream>
struct A { A g(int) { return A(); } };
struct B { B g() { return B(); } };
struct C
{
template<typename... Ts>
auto f(Ts... ts) -> decltype(A().g(ts...))
{ std::cout << "f -> A" << std::endl; return A(); }
template<typename... Ts>
auto f(Ts... ts) -> decltype(B().g(ts...))
{ std::cout << "f -> B" << std::endl; return B(); }
};
int main()
{
C c;
c.f(1);
}
GCC 4.7.2 Clang 3.2 , VC11 - . , , VC11 SFINAE, decltype, , , .
, ++ 11 (14.8.2/7):
, . , , nontype , (.. ) sizeof, decltype , . [...]
SFINAE 14.8.2/8, :
, . - , , . [...] .
, " "? , " ":
. , / , .. " " .
, whatsovever. , VC11 .
, " ", decltype (_b_caller__).
, , , ( - decltype ,). , .
, VC11.
P.S.: Q & A SO , SFINAE , .
EDIT:
, , , , . .
, f() . 14.6/8 ++ 11:
[...] , , . [...]
, , ( ) . , VC11, , , ( , ).