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_iterators.h"
     23 
     24 int main()
     25 {
     26     {
     27         std::regex_traits<char> t;
     28         const char a[] = "a";
     29         const char B[] = "B";
     30         typedef forward_iterator<const char*> F;
     31         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     32         t.imbue(std::locale("cs_CZ.ISO8859-2"));
     33         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     34     }
     35     {
     36         std::regex_traits<wchar_t> t;
     37         const wchar_t a[] = L"a";
     38         const wchar_t B[] = L"B";
     39         typedef forward_iterator<const wchar_t*> F;
     40         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     41         t.imbue(std::locale("cs_CZ.ISO8859-2"));
     42         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     43     }
     44 }
     45