B
B.D.
Can anyone explain way the transformation to upper case doesn't work
correctly in the following code if PROBLEM is defined but works correctly if
it's not defined? I'm using VC 7.1
#include <locale>
#include <string>
#include <algorithm>
#define PROBLEM
struct ToUpper
{
ToUpper(std::locale const& locale) : mLocale(locale) {}
char operator() (char c) const { return std::toupper(c,mLocale); }
std::locale const& mLocale;
};
#ifdef PROBLEM
std::locale my_locale( "Swedish" );
#endif
int main ()
{
#ifndef PROBLEM
std::locale my_locale( "Swedish" );
#endif
std::string s("abc åäö");
std::transform( s.begin(), s.end(), s.begin(), ToUpper(my_locale) );
return 0;
}
correctly in the following code if PROBLEM is defined but works correctly if
it's not defined? I'm using VC 7.1
#include <locale>
#include <string>
#include <algorithm>
#define PROBLEM
struct ToUpper
{
ToUpper(std::locale const& locale) : mLocale(locale) {}
char operator() (char c) const { return std::toupper(c,mLocale); }
std::locale const& mLocale;
};
#ifdef PROBLEM
std::locale my_locale( "Swedish" );
#endif
int main ()
{
#ifndef PROBLEM
std::locale my_locale( "Swedish" );
#endif
std::string s("abc åäö");
std::transform( s.begin(), s.end(), s.begin(), ToUpper(my_locale) );
return 0;
}