T
TheDD
Hello,
i don't manage to use the tolower() function:
#include <algorithm>
#include <iostream>
#include <locale>
#include <string>
using std::cout;
using std::ctype;
using std::endl;
using std::locale;
using std::string;
using std::transform;
using std::use_facet;
typedef ctype< char > char_ctype_facet;
int
main()
{
locale loc("");
const char_ctype_facet& ct = use_facet< char_ctype_facet >(loc);
string str("Hello world.");
transform(str.begin(), str.end(),
str.begin(), ct.tolower);
cout << str << endl;
return 0;
}
$ g++ -W -Wall -std=c++98 -pedantic tolower.cc
tolower.cc: In function `int main()':
tolower.cc:24: error: 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>)'
ct.tolower is <unknow type>
What am i doing wrong?
i don't manage to use the tolower() function:
#include <algorithm>
#include <iostream>
#include <locale>
#include <string>
using std::cout;
using std::ctype;
using std::endl;
using std::locale;
using std::string;
using std::transform;
using std::use_facet;
typedef ctype< char > char_ctype_facet;
int
main()
{
locale loc("");
const char_ctype_facet& ct = use_facet< char_ctype_facet >(loc);
string str("Hello world.");
transform(str.begin(), str.end(),
str.begin(), ct.tolower);
cout << str << endl;
return 0;
}
$ g++ -W -Wall -std=c++98 -pedantic tolower.cc
tolower.cc: In function `int main()':
tolower.cc:24: error: 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>)'
ct.tolower is <unknow type>
What am i doing wrong?