blob: e8b221507112e14665279c5e888446efa99b4705 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// POD character, std::char_traits specialization -*- C++ -*-
// Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// Gabriel Dos Reis <gdr@integrable-solutions.net>
// Benjamin Kosnik <bkoz@redhat.com>
#include <ext/pod_char_traits.h>
int main()
{
using namespace __gnu_cxx;
typedef unsigned short value_type;
typedef unsigned int int_type;
typedef character<value_type, int_type> char_type;
typedef std::char_traits<char_type> traits_type;
bool test __attribute__((unused)) = true;
// 1 char_type <-> value_type conversions
value_type uc1 = 'c';
value_type uc2 = 'd';
char_type c1 = { uc1 };
char_type c2 = { uc2 };
test = !(c1 == c2);
// 2 char_traits
test = traits_type::eq(c1, c2);
// 3 basic_string<char_type>
typedef std::basic_string<char_type> string_type;
string_type str;
char_type c3 = { value_type('b') };
char_type c4 = { value_type('o') };
char_type c5 = { value_type('r') };
char_type c6 = { value_type('a') };
char_type c7 = { value_type('c') };
char_type c8 = { value_type('a') };
char_type c9 = { value_type('y') };
str += c3;
str += c4;
str += c5;
str += c6;
str += c7;
str += c8;
str += c9;
string_type::size_type len __attribute__((unused)) = str.size();
const char_type* arr __attribute__((unused)) = str.c_str();
return 0;
}
|