Вызов шаблона: Фактическая специализация не вызывается

#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?

5
задан Cœur 6 September 2018 в 10:58
поделиться