Home | History | Annotate | Download | only in re.regex.locale
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <regex>
     11 
     12 // template <class charT, class traits = regex_traits<charT>> class basic_regex;
     13 
     14 // locale_type imbue(locale_type loc);
     15 
     16 #include <regex>
     17 #include <locale>
     18 #include <cassert>
     19 
     20 #include "platform_support.h" // locale name macros
     21 
     22 int main()
     23 {
     24     std::regex r;
     25     std::locale loc = r.imbue(std::locale(LOCALE_en_US_UTF_8));
     26     assert(loc.name() == "C");
     27     assert(r.getloc().name() == LOCALE_en_US_UTF_8);
     28     loc = r.imbue(std::locale("C"));
     29     assert(loc.name() == LOCALE_en_US_UTF_8);
     30     assert(r.getloc().name() == "C");
     31 }
     32