function template specialization failed?
function template specialization failed?
#include template void foo(T) { std::cout << "foo(T)" << std::endl; } template void foo(T*) { //#3 std::cout << "foo(T*)" << std::endl; } #define TEST #ifdef TEST template void foo(int*) { //#1 std::cout << "foo(int*)" << std::endl; } #else template void foo(int*) { //#2 std::cout << "foo(int*)" << std::endl; } #endif int main(int argc, char **argv) { int* p = 0; foo(p); return 0; }
View On WordPress
















