]> git.pld-linux.org Git - packages/STLport.git/blob - STLport-gcc420_dirty_hack.patch
- up to 5.1.2
[packages/STLport.git] / STLport-gcc420_dirty_hack.patch
1 --- STLport-5.1.0/stlport/ext/type_traits.h.orig        1970-01-01 00:00:00.000000000 +0000
2 +++ STLport-5.1.0/stlport/ext/type_traits.h     2006-12-18 12:56:32.000000000 +0000
3 @@ -0,0 +1,200 @@
4 +// -*- C++ -*-
5 +
6 +// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
7 +//
8 +// This file is part of the GNU ISO C++ Library.  This library is free
9 +// software; you can redistribute it and/or modify it under the terms
10 +// of the GNU General Public License as published by the Free Software
11 +// Foundation; either version 2, or (at your option) any later
12 +// version.
13 +
14 +// This library is distributed in the hope that it will be useful, but
15 +// WITHOUT ANY WARRANTY; without even the implied warranty of
16 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 +// General Public License for more details.
18 +
19 +// You should have received a copy of the GNU General Public License along
20 +// with this library; see the file COPYING.  If not, write to the Free
21 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 +// USA.
23 +
24 +// As a special exception, you may use this file as part of a free
25 +// software library without restriction.  Specifically, if other files
26 +// instantiate templates or use macros or inline functions from this
27 +// file, or you compile this file and link it with other files to
28 +// produce an executable, this file does not by itself cause the
29 +// resulting executable to be covered by the GNU General Public
30 +// License.  This exception does not however invalidate any other
31 +// reasons why the executable file might be covered by the GNU General
32 +// Public License.
33 +
34 +/** @file ext/type_traits.h
35 + *  This file is a GNU extension to the Standard C++ Library.
36 + */
37 +
38 +#ifndef _EXT_TYPE_TRAITS
39 +#define _EXT_TYPE_TRAITS 1
40 +
41 +#pragma GCC system_header
42 +
43 +#include <cstddef>
44 +#include <utility>
45 +#include <limits>
46 +#include <iosfwd> // std::streamsize
47 +#include <bits/cpp_type_traits.h>
48 +
49 +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
50 +
51 +  // Define a nested type if some predicate holds.
52 +  template<bool, typename>
53 +    struct __enable_if 
54 +    { };
55 +
56 +  template<typename _Tp>
57 +    struct __enable_if<true, _Tp>
58 +    { typedef _Tp __type; };
59 +
60 +
61 +  // Conditional expression for types. If true, first, if false, second.
62 +  template<bool _Cond, typename _Iftrue, typename _Iffalse>
63 +    struct __conditional_type
64 +    { typedef _Iftrue __type; };
65 +
66 +  template<typename _Iftrue, typename _Iffalse>
67 +    struct __conditional_type<false, _Iftrue, _Iffalse>
68 +    { typedef _Iffalse __type; };
69 +
70 +
71 +  // Given an integral builtin type, return the corresponding unsigned type.
72 +  template<typename _Tp>
73 +    struct __add_unsigned
74 +    { 
75 +    private:
76 +      typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
77 +      
78 +    public:
79 +      typedef typename __if_type::__type __type; 
80 +    };
81 +
82 +  template<>
83 +    struct __add_unsigned<char>
84 +    { typedef unsigned char __type; };
85 +
86 +  template<>
87 +    struct __add_unsigned<signed char>
88 +    { typedef unsigned char __type; };
89 +
90 +  template<>
91 +    struct __add_unsigned<short>
92 +    { typedef unsigned short __type; };
93 +
94 +  template<>
95 +    struct __add_unsigned<int>
96 +    { typedef unsigned int __type; };
97 +
98 +  template<>
99 +    struct __add_unsigned<long>
100 +    { typedef unsigned long __type; };
101 +
102 +  template<>
103 +    struct __add_unsigned<long long>
104 +    { typedef unsigned long long __type; };
105 +
106 +  // Declare but don't define.
107 +  template<>
108 +    struct __add_unsigned<bool>;
109 +
110 +  template<>
111 +    struct __add_unsigned<wchar_t>;
112 +
113 +
114 +  // Given an integral builtin type, return the corresponding signed type.
115 +  template<typename _Tp>
116 +    struct __remove_unsigned
117 +    { 
118 +    private:
119 +      typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
120 +      
121 +    public:
122 +      typedef typename __if_type::__type __type; 
123 +    };
124 +
125 +  template<>
126 +    struct __remove_unsigned<char>
127 +    { typedef signed char __type; };
128 +
129 +  template<>
130 +    struct __remove_unsigned<unsigned char>
131 +    { typedef signed char __type; };
132 +
133 +  template<>
134 +    struct __remove_unsigned<unsigned short>
135 +    { typedef short __type; };
136 +
137 +  template<>
138 +    struct __remove_unsigned<unsigned int>
139 +    { typedef int __type; };
140 +
141 +  template<>
142 +    struct __remove_unsigned<unsigned long>
143 +    { typedef long __type; };
144 +
145 +  template<>
146 +    struct __remove_unsigned<unsigned long long>
147 +    { typedef long long __type; };
148 +
149 +  // Declare but don't define.
150 +  template<>
151 +    struct __remove_unsigned<bool>;
152 +
153 +  template<>
154 +    struct __remove_unsigned<wchar_t>;
155 +
156 +
157 +  // Compile time constants for builtin types.
158 +  // Sadly std::numeric_limits member functions cannot be used for this.
159 +#define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0)
160 +#define __glibcxx_digits(_Tp) \
161 +  (sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp))
162 +
163 +#define __glibcxx_min(_Tp) \
164 +  (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
165 +
166 +#define __glibcxx_max(_Tp) \
167 +  (__glibcxx_signed(_Tp) ? ((_Tp)1 << __glibcxx_digits(_Tp)) - 1 : ~(_Tp)0)
168 +
169 +  template<typename _Value>
170 +    struct __numeric_traits_integer
171 +    {
172 +      // Only integers for initialization of member constant.
173 +      static const _Value __min = __glibcxx_min(_Value);
174 +      static const _Value __max = __glibcxx_max(_Value);
175 +    };
176 +
177 +  template<typename _Value>
178 +    const _Value __numeric_traits_integer<_Value>::__min;
179 +
180 +  template<typename _Value>
181 +    const _Value __numeric_traits_integer<_Value>::__max;
182 +
183 +  template<typename _Value>
184 +    struct __numeric_traits_floating
185 +    {
186 +      // Only floating point types. See N1822. 
187 +      static const _STLP_STD::streamsize __max_digits10 =
188 +       2 + _STLP_STD::numeric_limits<_Value>::digits * 3010/10000;
189 +    };
190 +
191 +  template<typename _Value>
192 +    const _STLP_STD::streamsize __numeric_traits_floating<_Value>::__max_digits10;
193 +
194 +  template<typename _Value>
195 +    struct __numeric_traits 
196 +    : public __conditional_type<std::__is_integer<_Value>::__value,
197 +                               __numeric_traits_integer<_Value>,
198 +                               __numeric_traits_floating<_Value> >::__type
199 +    { };
200 +
201 +_GLIBCXX_END_NAMESPACE
202 +
203 +#endif 
This page took 0.073373 seconds and 3 git commands to generate.