blob: 25281129158e6ea19e5427e6824aa35f00aa2e74 [file] [log] [blame]
Howard Hinnant70505302010-06-17 00:34:59 +00001// -*- C++ -*-
2//===-------------------------- algorithm ---------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. 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 "iterators.h"
21
22int 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}