- #1
Whovian
- 652
- 3
As a basic exercise in C++ functional programming, I wrote the following code:
I get the error error: call of overloaded 'swap(std::string&, std::string&)' is ambiguous when I compile. Why?
Code:
#include <iostream>
#include <string>
using namespace std;
template <class T>
void Wib (T& a,T& b)
{
T temp = a;
a = b;
b = temp;
};
int main()
{
string A = "World!";
string B = "Hello, ";
Wib <string> (A,B);
cout << A << B << endl;
return 0;
}
I get the error error: call of overloaded 'swap(std::string&, std::string&)' is ambiguous when I compile. Why?
Last edited: