Ticket #4649: token_functions.patch

File token_functions.patch, 2.0 KB (added by rvalde@…, 12 years ago)
  • C:/boost/boost_1_45_0/boost/token_functions

    old new  
    211211  // expect an int.
    212212  // In case there is no cwctype header, we implement the checks manually.
    213213  // We make use of the fact that the tested categories should fit in ASCII.
     214
     215#if !defined(BOOST_NO_CWCTYPE)
     216  template<typename traits, int N>
     217  struct traits_extension_details : public traits {
     218    typedef typename traits::char_type char_type;
     219    static bool isspace(char_type c)
     220    {
     221       return std::iswspace(c) != 0;
     222    }
     223    static bool ispunct(char_type c)
     224    {
     225       return std::iswpunct(c) != 0;
     226    }
     227  };
     228  template<typename traits>
     229  struct traits_extension_details<typename traits, 1> : public traits {
     230    typedef typename traits::char_type char_type;
     231    static bool isspace(char_type c)
     232    {
     233       return std::isspace(c) != 0;
     234    }
     235    static bool ispunct(char_type c)
     236    {
     237       return std::ispunct(c) != 0;
     238    }
     239  };
     240#endif
     241
    214242  template<typename traits>
    215243  struct traits_extension : public traits {
    216244    typedef typename traits::char_type char_type;
    217245    static bool isspace(char_type c)
    218246    {
    219247#if !defined(BOOST_NO_CWCTYPE)
    220       if (sizeof(char_type) == 1)
    221         return std::isspace(c) != 0;
    222       else
    223         return std::iswspace(c) != 0;
     248      return traits_extension_details<traits, sizeof(char_type)>::isspace(c);
    224249#else
    225250      return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0;
    226251#endif
     
    229254    static bool ispunct(char_type c)
    230255    {
    231256#if !defined(BOOST_NO_CWCTYPE)
    232       if (sizeof(char_type) == 1)
    233         return std::ispunct(c) != 0;
    234       else
    235         return std::iswpunct(c) != 0;
     257      return traits_extension_details<traits, sizeof(char_type)>::ispunct(c);
    236258#else
    237259      return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0;
    238260#endif