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 // <regex>
     12 
     13 // template <class charT> struct regex_traits;
     14 
     15 // template <class ForwardIterator>
     16 //   string_type transform(ForwardIterator first, ForwardIterator last) const;
     17 
     18 #include <regex>
     19 #include <cassert>
     20 #include "test_iterators.h"
     21 
     22 int main()
     23 {
     24     {
     25         std::regex_traits<char> t;
     26         const char a[] = "a";
     27         const char B[] = "B";
     28         typedef forward_iterator<const char*> F;
     29         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     30         t.imbue(std::locale("cs_CZ.ISO8859-2"));
     31         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     32     }
     33     {
     34         std::regex_traits<wchar_t> t;
     35         const wchar_t a[] = L"a";
     36         const wchar_t B[] = L"B";
     37         typedef forward_iterator<const wchar_t*> F;
     38         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     39         t.imbue(std::locale("cs_CZ.ISO8859-2"));
     40         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     41     }
     42 }
     43