2006-09-18 15:30:56 +02:00
|
|
|
// -*- C++ -*-
|
|
|
|
|
2022-01-03 10:42:10 +01:00
|
|
|
// Copyright (C) 2005-2022 Free Software Foundation, Inc.
|
2006-09-18 15:30:56 +02:00
|
|
|
//
|
|
|
|
// 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
|
2009-04-09 17:00:19 +02:00
|
|
|
// Foundation; either version 3, or (at your option) any later
|
2006-09-18 15:30:56 +02:00
|
|
|
// 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.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2006-09-18 15:30:56 +02:00
|
|
|
|
2006-11-29 21:59:22 +01:00
|
|
|
/** @file ext/type_traits.h
|
|
|
|
* This file is a GNU extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
2006-09-18 15:30:56 +02:00
|
|
|
#ifndef _EXT_TYPE_TRAITS
|
|
|
|
#define _EXT_TYPE_TRAITS 1
|
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
2007-04-06 16:52:27 +02:00
|
|
|
#include <bits/c++config.h>
|
2006-09-21 22:07:10 +02:00
|
|
|
#include <bits/cpp_type_traits.h>
|
2006-09-18 15:30:56 +02:00
|
|
|
|
2016-01-21 14:33:27 +01:00
|
|
|
extern "C++" {
|
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
2006-09-18 15:30:56 +02:00
|
|
|
|
|
|
|
// Define a nested type if some predicate holds.
|
|
|
|
template<bool, typename>
|
|
|
|
struct __enable_if
|
|
|
|
{ };
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
struct __enable_if<true, _Tp>
|
|
|
|
{ typedef _Tp __type; };
|
|
|
|
|
2006-09-29 15:38:58 +02:00
|
|
|
|
2006-09-18 15:30:56 +02:00
|
|
|
// Conditional expression for types. If true, first, if false, second.
|
|
|
|
template<bool _Cond, typename _Iftrue, typename _Iffalse>
|
|
|
|
struct __conditional_type
|
|
|
|
{ typedef _Iftrue __type; };
|
|
|
|
|
|
|
|
template<typename _Iftrue, typename _Iffalse>
|
|
|
|
struct __conditional_type<false, _Iftrue, _Iffalse>
|
|
|
|
{ typedef _Iffalse __type; };
|
|
|
|
|
|
|
|
|
2006-09-29 15:38:58 +02:00
|
|
|
// Given an integral builtin type, return the corresponding unsigned type.
|
2006-10-01 12:39:16 +02:00
|
|
|
template<typename _Tp>
|
2006-09-18 15:30:56 +02:00
|
|
|
struct __add_unsigned
|
2006-09-29 15:38:58 +02:00
|
|
|
{
|
|
|
|
private:
|
2006-10-01 12:39:16 +02:00
|
|
|
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
|
2006-09-29 15:38:58 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef typename __if_type::__type __type;
|
|
|
|
};
|
2006-09-18 15:30:56 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<char>
|
|
|
|
{ typedef unsigned char __type; };
|
|
|
|
|
2006-09-29 15:38:58 +02:00
|
|
|
template<>
|
|
|
|
struct __add_unsigned<signed char>
|
|
|
|
{ typedef unsigned char __type; };
|
|
|
|
|
2006-09-18 15:30:56 +02:00
|
|
|
template<>
|
|
|
|
struct __add_unsigned<short>
|
|
|
|
{ typedef unsigned short __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<int>
|
|
|
|
{ typedef unsigned int __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<long>
|
|
|
|
{ typedef unsigned long __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<long long>
|
|
|
|
{ typedef unsigned long long __type; };
|
|
|
|
|
2006-09-29 15:38:58 +02:00
|
|
|
// Declare but don't define.
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<bool>;
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __add_unsigned<wchar_t>;
|
|
|
|
|
|
|
|
|
|
|
|
// Given an integral builtin type, return the corresponding signed type.
|
2006-10-01 12:39:16 +02:00
|
|
|
template<typename _Tp>
|
2006-09-18 15:30:56 +02:00
|
|
|
struct __remove_unsigned
|
2006-09-29 15:38:58 +02:00
|
|
|
{
|
|
|
|
private:
|
2006-10-01 12:39:16 +02:00
|
|
|
typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
|
2006-09-29 15:38:58 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef typename __if_type::__type __type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<char>
|
|
|
|
{ typedef signed char __type; };
|
2006-09-18 15:30:56 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<unsigned char>
|
2006-09-29 15:38:58 +02:00
|
|
|
{ typedef signed char __type; };
|
2006-09-18 15:30:56 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<unsigned short>
|
|
|
|
{ typedef short __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<unsigned int>
|
|
|
|
{ typedef int __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<unsigned long>
|
|
|
|
{ typedef long __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<unsigned long long>
|
|
|
|
{ typedef long long __type; };
|
2006-09-29 15:38:58 +02:00
|
|
|
|
|
|
|
// Declare but don't define.
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<bool>;
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __remove_unsigned<wchar_t>;
|
|
|
|
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
|
|
|
|
// For use in string and vstring.
|
|
|
|
template<typename _Type>
|
2020-02-26 23:43:45 +01:00
|
|
|
_GLIBCXX_CONSTEXPR
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
inline bool
|
|
|
|
__is_null_pointer(_Type* __ptr)
|
|
|
|
{ return __ptr == 0; }
|
|
|
|
|
|
|
|
template<typename _Type>
|
2020-02-26 23:43:45 +01:00
|
|
|
_GLIBCXX_CONSTEXPR
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
inline bool
|
|
|
|
__is_null_pointer(_Type)
|
|
|
|
{ return false; }
|
|
|
|
|
2013-05-24 20:27:59 +02:00
|
|
|
#if __cplusplus >= 201103L
|
2020-02-26 23:43:45 +01:00
|
|
|
constexpr bool
|
2013-05-24 20:27:59 +02:00
|
|
|
__is_null_pointer(std::nullptr_t)
|
|
|
|
{ return true; }
|
|
|
|
#endif
|
2007-06-01 01:37:56 +02:00
|
|
|
|
2021-08-12 18:35:25 +02:00
|
|
|
// For arithmetic promotions in <complex> and <cmath>
|
|
|
|
|
2007-06-01 01:37:56 +02:00
|
|
|
template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
|
|
|
|
struct __promote
|
|
|
|
{ typedef double __type; };
|
|
|
|
|
2011-11-12 16:57:03 +01:00
|
|
|
// No nested __type member for non-integer non-floating point types,
|
|
|
|
// allows this type to be used for SFINAE to constrain overloads in
|
|
|
|
// <cmath> and <complex> to only the intended types.
|
2007-06-01 01:37:56 +02:00
|
|
|
template<typename _Tp>
|
|
|
|
struct __promote<_Tp, false>
|
2011-11-12 16:57:03 +01:00
|
|
|
{ };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __promote<long double>
|
|
|
|
{ typedef long double __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __promote<double>
|
|
|
|
{ typedef double __type; };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __promote<float>
|
|
|
|
{ typedef float __type; };
|
2007-06-01 01:37:56 +02:00
|
|
|
|
2021-08-12 18:35:25 +02:00
|
|
|
#if __cpp_fold_expressions
|
2021-08-17 21:26:52 +02:00
|
|
|
|
2021-08-12 18:35:25 +02:00
|
|
|
template<typename... _Tp>
|
|
|
|
using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...));
|
2021-08-17 21:26:52 +02:00
|
|
|
|
|
|
|
// Deducing the promoted type is done by __promoted_t<_Tp...>,
|
|
|
|
// then __promote is used to provide the nested __type member.
|
|
|
|
template<typename _Tp, typename _Up>
|
|
|
|
using __promote_2 = __promote<__promoted_t<_Tp, _Up>>;
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Up, typename _Vp>
|
|
|
|
using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>;
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
|
|
|
|
using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>;
|
|
|
|
|
|
|
|
#else
|
2021-08-12 18:35:25 +02:00
|
|
|
|
2011-11-12 16:57:03 +01:00
|
|
|
template<typename _Tp, typename _Up,
|
|
|
|
typename _Tp2 = typename __promote<_Tp>::__type,
|
|
|
|
typename _Up2 = typename __promote<_Up>::__type>
|
2007-06-01 01:37:56 +02:00
|
|
|
struct __promote_2
|
|
|
|
{
|
2011-11-12 16:57:03 +01:00
|
|
|
typedef __typeof__(_Tp2() + _Up2()) __type;
|
2007-06-01 01:37:56 +02:00
|
|
|
};
|
|
|
|
|
2011-11-12 16:57:03 +01:00
|
|
|
template<typename _Tp, typename _Up, typename _Vp,
|
|
|
|
typename _Tp2 = typename __promote<_Tp>::__type,
|
|
|
|
typename _Up2 = typename __promote<_Up>::__type,
|
|
|
|
typename _Vp2 = typename __promote<_Vp>::__type>
|
2007-06-01 01:37:56 +02:00
|
|
|
struct __promote_3
|
|
|
|
{
|
2011-11-12 16:57:03 +01:00
|
|
|
typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;
|
2007-06-01 01:37:56 +02:00
|
|
|
};
|
|
|
|
|
2011-11-12 16:57:03 +01:00
|
|
|
template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
|
|
|
|
typename _Tp2 = typename __promote<_Tp>::__type,
|
|
|
|
typename _Up2 = typename __promote<_Up>::__type,
|
|
|
|
typename _Vp2 = typename __promote<_Vp>::__type,
|
|
|
|
typename _Wp2 = typename __promote<_Wp>::__type>
|
2007-06-01 01:37:56 +02:00
|
|
|
struct __promote_4
|
|
|
|
{
|
2011-11-12 16:57:03 +01:00
|
|
|
typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
|
2007-06-01 01:37:56 +02:00
|
|
|
};
|
2021-08-17 21:26:52 +02:00
|
|
|
#endif
|
2007-06-01 01:37:56 +02:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
|
|
|
} // namespace
|
2016-01-21 14:33:27 +01:00
|
|
|
} // extern "C++"
|
2006-09-18 15:30:56 +02:00
|
|
|
|
|
|
|
#endif
|