#include <iostream>
using namespace std;
template<typename T>
void test() {
cout << "1";
}
template<>
void test<std::string>() {
cout << "2";
}
int main() {
test<std::string()>(); //expected output 2 but actual output 1
}
आउटपुट 1 और 2 क्यों नहीं है?टेम्पलेट कॉल में संदेह: वास्तविक विशेषज्ञता
क्यों एक downvote देना होगा
foo<std::string>()
यानी आउटपुट के रूप में 2 प्राप्त करने के लिए आदेश में कोष्ठकों()
हटाने की जरूरत? –