Sumit Rajan said:
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
int main()
{
std::string str("john smith");
std::transform(str.begin(),str.end(),str.begin(),std::toupper);
std::cout << str << '\n';
}
So, what went wrong here? Do I have a bad compiler or something?
fatire:[** NONE **]:/home/mz652c% cat test.cpp
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
int main()
{
std::string str("john smith");
std::transform(str.begin(),str.end(),str.begin(),std::toupper);
std::cout << str << '\n';
}
fatire:[** NONE **]:/home/mz652c% g++ -o test test.cpp
test.cpp: In function `int main()':
test.cpp:9: no matching function for call to `transform(
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, <unknown type>)'
fatire:[** NONE **]:/home/mz652c% g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with:
.../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking --with-system-zli
b --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)