• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17 //   transform_primary(ForwardIterator first, ForwardIterator last) const;
18 
19 #include <regex>
20 #include <cassert>
21 #include "test_iterators.h"
22 
main()23 int main()
24 {
25     {
26         std::regex_traits<char> t;
27         const char A[] = "A";
28         const char Aacute[] = "\xC1";
29         typedef forward_iterator<const char*> F;
30         assert(t.transform_primary(F(A), F(A+1)) !=
31                t.transform_primary(F(Aacute), F(Aacute+1)));
32         t.imbue(std::locale("cs_CZ.ISO8859-2"));
33         assert(t.transform_primary(F(A), F(A+1)) ==
34                t.transform_primary(F(Aacute), F(Aacute+1)));
35     }
36     {
37         std::regex_traits<wchar_t> t;
38         const wchar_t A[] = L"A";
39         const wchar_t Aacute[] = L"\xC1";
40         typedef forward_iterator<const wchar_t*> F;
41         assert(t.transform_primary(F(A), F(A+1)) !=
42                t.transform_primary(F(Aacute), F(Aacute+1)));
43         t.imbue(std::locale("cs_CZ.ISO8859-2"));
44         assert(t.transform_primary(F(A), F(A+1)) ==
45                t.transform_primary(F(Aacute), F(Aacute+1)));
46     }
47 }
48