W
Wei
Hi all,
I found out I can use the max function which is defined in STL
<algorithm> without including this header in my program. The compilers
I used are GNU g++ 3.4.4 and Visual Studio C++ 2005.
The program is as follows:
#include <iostream>
//#include <algorithm> <-- I don't have to include <algorithm> in
order to use max.
#include <string>
using namespace std;
int main()
{
string str1("abc"), str2("acb");
cout << max(str1, str2) << endl;
return 0;
}
Does anybody know why is that?
Thanks
Wei
I found out I can use the max function which is defined in STL
<algorithm> without including this header in my program. The compilers
I used are GNU g++ 3.4.4 and Visual Studio C++ 2005.
The program is as follows:
#include <iostream>
//#include <algorithm> <-- I don't have to include <algorithm> in
order to use max.
#include <string>
using namespace std;
int main()
{
string str1("abc"), str2("acb");
cout << max(str1, str2) << endl;
return 0;
}
Does anybody know why is that?
Thanks
Wei