Home | History | Annotate | Download | only in re.traits
      1 // -*- C++ -*-
      2 //===----------------------------------------------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 
     11 // REQUIRES: locale.cs_CZ.ISO8859-2
     12 
     13 // <regex>
     14 
     15 // template <class charT> struct regex_traits;
     16 
     17 // template <class ForwardIterator>
     18 //   string_type transform(ForwardIterator first, ForwardIterator last) const;
     19 
     20 #include <regex>
     21 #include <cassert>
     22 #include "test_macros.h"
     23 #include "test_iterators.h"
     24 #include "platform_support.h" // locale name macros
     25 
     26 int main()
     27 {
     28     {
     29         std::regex_traits<char> t;
     30         const char a[] = "a";
     31         const char B[] = "B";
     32         typedef forward_iterator<const char*> F;
     33         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     34         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
     35         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     36     }
     37     {
     38         std::regex_traits<wchar_t> t;
     39         const wchar_t a[] = L"a";
     40         const wchar_t B[] = L"B";
     41         typedef forward_iterator<const wchar_t*> F;
     42         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     43         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
     44         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     45     }
     46 }
     47