Ticket #4649: 4649-mtc-2.patch
File 4649-mtc-2.patch, 2.1 KB (added by , 12 years ago) |
---|
-
boost/token_functions.hpp
209 209 // Assuming that the conditional will always get optimized out in the function 210 210 // implementations, argument types are not a problem since both forms of character classifiers 211 211 // expect an int. 212 213 #if !defined(BOOST_NO_CWCTYPE) 214 template<typename traits, int N> 215 struct traits_extension_details : public traits { 216 typedef typename traits::char_type char_type; 217 static bool isspace(char_type c) 218 { 219 return std::iswspace(c) != 0; 220 } 221 static bool ispunct(char_type c) 222 { 223 return std::iswpunct(c) != 0; 224 } 225 }; 226 227 template<typename traits> 228 struct traits_extension_details<traits, 1> : public traits { 229 typedef typename traits::char_type char_type; 230 static bool isspace(char_type c) 231 { 232 return std::isspace(c) != 0; 233 } 234 static bool ispunct(char_type c) 235 { 236 return std::ispunct(c) != 0; 237 } 238 }; 239 #endif 240 241 212 242 // In case there is no cwctype header, we implement the checks manually. 213 243 // We make use of the fact that the tested categories should fit in ASCII. 214 244 template<typename traits> … … 217 247 static bool isspace(char_type c) 218 248 { 219 249 #if !defined(BOOST_NO_CWCTYPE) 220 if (sizeof(char_type) == 1) 221 return std::isspace(static_cast<int>(c)) != 0; 222 else 223 return std::iswspace(static_cast<std::wint_t>(c)) != 0; 250 return traits_extension_details<traits, sizeof(char_type)>::isspace(c); 224 251 #else 225 252 return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0; 226 253 #endif … … 229 256 static bool ispunct(char_type c) 230 257 { 231 258 #if !defined(BOOST_NO_CWCTYPE) 232 if (sizeof(char_type) == 1) 233 return std::ispunct(static_cast<int>(c)) != 0; 234 else 235 return std::iswpunct(static_cast<std::wint_t>(c)) != 0; 259 return traits_extension_details<traits, sizeof(char_type)>::ispunct(c); 236 260 #else 237 261 return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0; 238 262 #endif