I got some problem on template.This code passed under vc6 but failed under g++. Is there anybody could tell me the reason? thanks.
#include
u
The function swap() is already exists in iostream
. Therefore, it conflicts with your swap() function. You may have to specify that which swap() you want to use or change the name of your swap function like swap1(), swap2() etc. You could change any letter into UPPERCASE of your swap function like Swap() this could resolve the problem without removing using namespace std;
otherwise, just remove using namespace std'
and type
using std :: cout;
using std :: endl;
instead OR write the code like -
std :: cout << "After swapping - a = " << a << ", b = " << b << std :: endl;
That's it. Thank you.