OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc4/] [libstdc++-v3/] [include/] [std/] [type_traits] - Diff between revs 424 and 519

Only display areas with differences | Details | Blame | View Log

Rev 424 Rev 519
// C++0x type_traits -*- C++ -*-
// C++0x type_traits -*- C++ -*-
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
//
// This file is part of the GNU ISO C++ Library.  This library is free
// 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
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// any later version.
// This library is distributed in the hope that it will be useful,
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// 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;
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// .
// .
/** @file include/type_traits
/** @file include/type_traits
 *  This is a Standard C++ Library header.
 *  This is a Standard C++ Library header.
 */
 */
#ifndef _GLIBCXX_TYPE_TRAITS
#ifndef _GLIBCXX_TYPE_TRAITS
#define _GLIBCXX_TYPE_TRAITS 1
#define _GLIBCXX_TYPE_TRAITS 1
#pragma GCC system_header
#pragma GCC system_header
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include 
# include 
#else
#else
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
#  error C++0x header cannot be included from TR1 header
#  error C++0x header cannot be included from TR1 header
#endif
#endif
#include 
#include 
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
#  include 
#  include 
#else
#else
#  define _GLIBCXX_INCLUDE_AS_CXX0X
#  define _GLIBCXX_INCLUDE_AS_CXX0X
#  define _GLIBCXX_BEGIN_NAMESPACE_TR1
#  define _GLIBCXX_BEGIN_NAMESPACE_TR1
#  define _GLIBCXX_END_NAMESPACE_TR1
#  define _GLIBCXX_END_NAMESPACE_TR1
#  define _GLIBCXX_TR1
#  define _GLIBCXX_TR1
#  include 
#  include 
#  undef _GLIBCXX_TR1
#  undef _GLIBCXX_TR1
#  undef _GLIBCXX_END_NAMESPACE_TR1
#  undef _GLIBCXX_END_NAMESPACE_TR1
#  undef _GLIBCXX_BEGIN_NAMESPACE_TR1
#  undef _GLIBCXX_BEGIN_NAMESPACE_TR1
#  undef _GLIBCXX_INCLUDE_AS_CXX0X
#  undef _GLIBCXX_INCLUDE_AS_CXX0X
#endif
#endif
namespace std
namespace std
{
{
  /**
  /**
   * @addtogroup metaprogramming
   * @addtogroup metaprogramming
   * @{
   * @{
   */
   */
  // Primary classification traits.
  // Primary classification traits.
  /// is_lvalue_reference
  /// is_lvalue_reference
  template
  template
    struct is_lvalue_reference
    struct is_lvalue_reference
    : public false_type { };
    : public false_type { };
  template
  template
    struct is_lvalue_reference<_Tp&>
    struct is_lvalue_reference<_Tp&>
    : public true_type { };
    : public true_type { };
  /// is_rvalue_reference
  /// is_rvalue_reference
  template
  template
    struct is_rvalue_reference
    struct is_rvalue_reference
    : public false_type { };
    : public false_type { };
  template
  template
    struct is_rvalue_reference<_Tp&&>
    struct is_rvalue_reference<_Tp&&>
    : public true_type { };
    : public true_type { };
  // Secondary classification traits.
  // Secondary classification traits.
  /// is_reference
  /// is_reference
  template
  template
    struct is_reference
    struct is_reference
    : public integral_constant::value
    : public integral_constant::value
                                      || is_rvalue_reference<_Tp>::value)>
                                      || is_rvalue_reference<_Tp>::value)>
    { };
    { };
  // Reference transformations.
  // Reference transformations.
  /// remove_reference
  /// remove_reference
  template
  template
    struct remove_reference
    struct remove_reference
    { typedef _Tp   type; };
    { typedef _Tp   type; };
  template
  template
    struct remove_reference<_Tp&>
    struct remove_reference<_Tp&>
    { typedef _Tp   type; };
    { typedef _Tp   type; };
  template
  template
    struct remove_reference<_Tp&&>
    struct remove_reference<_Tp&&>
    { typedef _Tp   type; };
    { typedef _Tp   type; };
  template
  template
           bool = !is_reference<_Tp>::value && !is_void<_Tp>::value,
           bool = !is_reference<_Tp>::value && !is_void<_Tp>::value,
           bool = is_rvalue_reference<_Tp>::value>
           bool = is_rvalue_reference<_Tp>::value>
    struct __add_lvalue_reference_helper
    struct __add_lvalue_reference_helper
    { typedef _Tp   type; };
    { typedef _Tp   type; };
  template
  template
    struct __add_lvalue_reference_helper<_Tp, true, false>
    struct __add_lvalue_reference_helper<_Tp, true, false>
    { typedef _Tp&   type; };
    { typedef _Tp&   type; };
  template
  template
    struct __add_lvalue_reference_helper<_Tp, false, true>
    struct __add_lvalue_reference_helper<_Tp, false, true>
    { typedef typename remove_reference<_Tp>::type&   type; };
    { typedef typename remove_reference<_Tp>::type&   type; };
  /// add_lvalue_reference
  /// add_lvalue_reference
  template
  template
    struct add_lvalue_reference
    struct add_lvalue_reference
    : public __add_lvalue_reference_helper<_Tp>
    : public __add_lvalue_reference_helper<_Tp>
    { };
    { };
  template
  template
           bool = !is_reference<_Tp>::value && !is_void<_Tp>::value>
           bool = !is_reference<_Tp>::value && !is_void<_Tp>::value>
    struct __add_rvalue_reference_helper
    struct __add_rvalue_reference_helper
    { typedef _Tp   type; };
    { typedef _Tp   type; };
  template
  template
    struct __add_rvalue_reference_helper<_Tp, true>
    struct __add_rvalue_reference_helper<_Tp, true>
    { typedef _Tp&&   type; };
    { typedef _Tp&&   type; };
  /// add_rvalue_reference
  /// add_rvalue_reference
  template
  template
    struct add_rvalue_reference
    struct add_rvalue_reference
    : public __add_rvalue_reference_helper<_Tp>
    : public __add_rvalue_reference_helper<_Tp>
    { };
    { };
  // Scalar properties and transformations.
  // Scalar properties and transformations.
  template
  template
           bool = is_integral<_Tp>::value,
           bool = is_integral<_Tp>::value,
           bool = is_floating_point<_Tp>::value>
           bool = is_floating_point<_Tp>::value>
    struct __is_signed_helper
    struct __is_signed_helper
    : public false_type { };
    : public false_type { };
  template
  template
    struct __is_signed_helper<_Tp, false, true>
    struct __is_signed_helper<_Tp, false, true>
    : public true_type { };
    : public true_type { };
  template
  template
    struct __is_signed_helper<_Tp, true, false>
    struct __is_signed_helper<_Tp, true, false>
    : public integral_constant(_Tp(-1) < _Tp(0))>
    : public integral_constant(_Tp(-1) < _Tp(0))>
    { };
    { };
  /// is_signed
  /// is_signed
  template
  template
    struct is_signed
    struct is_signed
    : public integral_constant::value>
    : public integral_constant::value>
    { };
    { };
  /// is_unsigned
  /// is_unsigned
  template
  template
    struct is_unsigned
    struct is_unsigned
    : public integral_constant::value
    : public integral_constant::value
                                      && !is_signed<_Tp>::value)>
                                      && !is_signed<_Tp>::value)>
    { };
    { };
  // Member introspection.
  // Member introspection.
  /// is_trivial
  /// is_trivial
  template
  template
    struct is_trivial
    struct is_trivial
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// is_standard_layout
  /// is_standard_layout
  template
  template
    struct is_standard_layout
    struct is_standard_layout
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// is_pod
  /// is_pod
  // Could use is_standard_layout && is_trivial instead of the builtin.
  // Could use is_standard_layout && is_trivial instead of the builtin.
  template
  template
    struct is_pod
    struct is_pod
    : public integral_constant
    : public integral_constant
    { };
    { };
  template
  template
    typename add_rvalue_reference<_Tp>::type declval();
    typename add_rvalue_reference<_Tp>::type declval();
  template
  template
    class __is_constructible_helper
    class __is_constructible_helper
    : public __sfinae_types
    : public __sfinae_types
    {
    {
      template
      template
        static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
        static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
      template
      template
        static __two __test(...);
        static __two __test(...);
    public:
    public:
      static const bool __value = sizeof(__test<_Tp, _Args...>(0)) == 1;
      static const bool __value = sizeof(__test<_Tp, _Args...>(0)) == 1;
    };
    };
  template
  template
    class __is_constructible_helper<_Tp, _Arg>
    class __is_constructible_helper<_Tp, _Arg>
    : public __sfinae_types
    : public __sfinae_types
    {
    {
      template
      template
        static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
        static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
        __test(int);
        __test(int);
      template
      template
        static __two __test(...);
        static __two __test(...);
    public:
    public:
      static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
      static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
    };
    };
  /// is_constructible
  /// is_constructible
  // XXX FIXME
  // XXX FIXME
  // The C++0x specifications require front-end support, see N2255.
  // The C++0x specifications require front-end support, see N2255.
  template
  template
    struct is_constructible
    struct is_constructible
    : public integral_constant
    : public integral_constant
                               __is_constructible_helper<_Tp,
                               __is_constructible_helper<_Tp,
                                                         _Args...>::__value>
                                                         _Args...>::__value>
    { };
    { };
  /// has_trivial_default_constructor
  /// has_trivial_default_constructor
  template
  template
    struct has_trivial_default_constructor
    struct has_trivial_default_constructor
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_trivial_copy_constructor
  /// has_trivial_copy_constructor
  template
  template
    struct has_trivial_copy_constructor
    struct has_trivial_copy_constructor
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_trivial_assign
  /// has_trivial_assign
  template
  template
    struct has_trivial_assign
    struct has_trivial_assign
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_trivial_destructor
  /// has_trivial_destructor
  template
  template
    struct has_trivial_destructor
    struct has_trivial_destructor
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_nothrow_default_constructor
  /// has_nothrow_default_constructor
  template
  template
    struct has_nothrow_default_constructor
    struct has_nothrow_default_constructor
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_nothrow_copy_constructor
  /// has_nothrow_copy_constructor
  template
  template
    struct has_nothrow_copy_constructor
    struct has_nothrow_copy_constructor
    : public integral_constant
    : public integral_constant
    { };
    { };
  /// has_nothrow_assign
  /// has_nothrow_assign
  template
  template
    struct has_nothrow_assign
    struct has_nothrow_assign
    : public integral_constant
    : public integral_constant
    { };
    { };
  // Relationships between types.
  // Relationships between types.
  /// is_base_of
  /// is_base_of
  template
  template
    struct is_base_of
    struct is_base_of
    : public integral_constant
    : public integral_constant
    { };
    { };
  template
  template
           bool = (is_void<_From>::value || is_void<_To>::value
           bool = (is_void<_From>::value || is_void<_To>::value
                   || is_function<_To>::value || is_array<_To>::value)>
                   || is_function<_To>::value || is_array<_To>::value)>
    struct __is_convertible_helper
    struct __is_convertible_helper
    { static const bool __value = (is_void<_From>::value
    { static const bool __value = (is_void<_From>::value
                                   && is_void<_To>::value); };
                                   && is_void<_To>::value); };
  template
  template
    class __is_convertible_helper<_From, _To, false>
    class __is_convertible_helper<_From, _To, false>
    : public __sfinae_types
    : public __sfinae_types
    {
    {
      static __one __test(_To);
      static __one __test(_To);
      static __two __test(...);
      static __two __test(...);
    public:
    public:
      static const bool __value = sizeof(__test(declval<_From>())) == 1;
      static const bool __value = sizeof(__test(declval<_From>())) == 1;
    };
    };
  /// is_convertible
  /// is_convertible
  // XXX FIXME
  // XXX FIXME
  // The C++0x specifications require front-end support, see N2255.
  // The C++0x specifications require front-end support, see N2255.
  template
  template
    struct is_convertible
    struct is_convertible
    : public integral_constant
    : public integral_constant
                               __is_convertible_helper<_From, _To>::__value>
                               __is_convertible_helper<_From, _To>::__value>
    { };
    { };
  /// is_explicitly_convertible
  /// is_explicitly_convertible
  template
  template
    struct is_explicitly_convertible
    struct is_explicitly_convertible
    : public is_constructible<_To, _From>
    : public is_constructible<_To, _From>
    { };
    { };
  template
  template
    struct __aligned_storage_msa
    struct __aligned_storage_msa
    {
    {
      union __type
      union __type
      {
      {
        unsigned char __data[_Len];
        unsigned char __data[_Len];
        struct __attribute__((__aligned__)) { } __align;
        struct __attribute__((__aligned__)) { } __align;
      };
      };
    };
    };
  /**
  /**
   *  @brief Alignment type.
   *  @brief Alignment type.
   *
   *
   *  The value of _Align is a default-alignment which shall be the
   *  The value of _Align is a default-alignment which shall be the
   *  most stringent alignment requirement for any C++ object type
   *  most stringent alignment requirement for any C++ object type
   *  whose size is no greater than _Len (3.9). The member typedef
   *  whose size is no greater than _Len (3.9). The member typedef
   *  type shall be a POD type suitable for use as uninitialized
   *  type shall be a POD type suitable for use as uninitialized
   *  storage for any object whose size is at most _Len and whose
   *  storage for any object whose size is at most _Len and whose
   *  alignment is a divisor of _Align.
   *  alignment is a divisor of _Align.
  */
  */
  template
  template
           __alignof__(typename __aligned_storage_msa<_Len>::__type)>
           __alignof__(typename __aligned_storage_msa<_Len>::__type)>
    struct aligned_storage
    struct aligned_storage
    {
    {
      union type
      union type
      {
      {
        unsigned char __data[_Len];
        unsigned char __data[_Len];
        struct __attribute__((__aligned__((_Align)))) { } __align;
        struct __attribute__((__aligned__((_Align)))) { } __align;
      };
      };
    };
    };
  // Define a nested type if some predicate holds.
  // Define a nested type if some predicate holds.
  // Primary template.
  // Primary template.
  /// enable_if
  /// enable_if
  template
  template
    struct enable_if
    struct enable_if
    { };
    { };
  // Partial specialization for true.
  // Partial specialization for true.
  template
  template
    struct enable_if
    struct enable_if
    { typedef _Tp type; };
    { typedef _Tp type; };
  // A conditional expression, but for types. If true, first, if false, second.
  // A conditional expression, but for types. If true, first, if false, second.
  // Primary template.
  // Primary template.
  /// conditional
  /// conditional
  template
  template
    struct conditional
    struct conditional
    { typedef _Iftrue type; };
    { typedef _Iftrue type; };
  // Partial specialization for false.
  // Partial specialization for false.
  template
  template
    struct conditional
    struct conditional
    { typedef _Iffalse type; };
    { typedef _Iffalse type; };
  // Decay trait for arrays and functions, used for perfect forwarding
  // Decay trait for arrays and functions, used for perfect forwarding
  // in make_pair, make_tuple, etc.
  // in make_pair, make_tuple, etc.
  template
  template
           bool _IsArray = is_array<_Up>::value,
           bool _IsArray = is_array<_Up>::value,
           bool _IsFunction = is_function<_Up>::value>
           bool _IsFunction = is_function<_Up>::value>
    struct __decay_selector;
    struct __decay_selector;
  // NB: DR 705.
  // NB: DR 705.
  template
  template
    struct __decay_selector<_Up, false, false>
    struct __decay_selector<_Up, false, false>
    { typedef typename remove_cv<_Up>::type __type; };
    { typedef typename remove_cv<_Up>::type __type; };
  template
  template
    struct __decay_selector<_Up, true, false>
    struct __decay_selector<_Up, true, false>
    { typedef typename remove_extent<_Up>::type* __type; };
    { typedef typename remove_extent<_Up>::type* __type; };
  template
  template
    struct __decay_selector<_Up, false, true>
    struct __decay_selector<_Up, false, true>
    { typedef typename add_pointer<_Up>::type __type; };
    { typedef typename add_pointer<_Up>::type __type; };
  /// decay
  /// decay
  template
  template
    class decay
    class decay
    {
    {
      typedef typename remove_reference<_Tp>::type __remove_type;
      typedef typename remove_reference<_Tp>::type __remove_type;
    public:
    public:
      typedef typename __decay_selector<__remove_type>::__type type;
      typedef typename __decay_selector<__remove_type>::__type type;
    };
    };
  // Utility for constructing identically cv-qualified types.
  // Utility for constructing identically cv-qualified types.
  template
  template
    struct __cv_selector;
    struct __cv_selector;
  template
  template
    struct __cv_selector<_Unqualified, false, false>
    struct __cv_selector<_Unqualified, false, false>
    { typedef _Unqualified __type; };
    { typedef _Unqualified __type; };
  template
  template
    struct __cv_selector<_Unqualified, false, true>
    struct __cv_selector<_Unqualified, false, true>
    { typedef volatile _Unqualified __type; };
    { typedef volatile _Unqualified __type; };
  template
  template
    struct __cv_selector<_Unqualified, true, false>
    struct __cv_selector<_Unqualified, true, false>
    { typedef const _Unqualified __type; };
    { typedef const _Unqualified __type; };
  template
  template
    struct __cv_selector<_Unqualified, true, true>
    struct __cv_selector<_Unqualified, true, true>
    { typedef const volatile _Unqualified __type; };
    { typedef const volatile _Unqualified __type; };
  template
  template
           bool _IsConst = is_const<_Qualified>::value,
           bool _IsConst = is_const<_Qualified>::value,
           bool _IsVol = is_volatile<_Qualified>::value>
           bool _IsVol = is_volatile<_Qualified>::value>
    class __match_cv_qualifiers
    class __match_cv_qualifiers
    {
    {
      typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
      typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
    public:
    public:
      typedef typename __match::__type __type;
      typedef typename __match::__type __type;
    };
    };
  // Utility for finding the unsigned versions of signed integral types.
  // Utility for finding the unsigned versions of signed integral types.
  template
  template
    struct __make_unsigned
    struct __make_unsigned
    { typedef _Tp __type; };
    { typedef _Tp __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned char __type; };
    { typedef unsigned char __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned char __type; };
    { typedef unsigned char __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned short __type; };
    { typedef unsigned short __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned int __type; };
    { typedef unsigned int __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned long __type; };
    { typedef unsigned long __type; };
  template<>
  template<>
    struct __make_unsigned
    struct __make_unsigned
    { typedef unsigned long long __type; };
    { typedef unsigned long long __type; };
  // Select between integral and enum: not possible to be both.
  // Select between integral and enum: not possible to be both.
  template
  template
           bool _IsInt = is_integral<_Tp>::value,
           bool _IsInt = is_integral<_Tp>::value,
           bool _IsEnum = is_enum<_Tp>::value>
           bool _IsEnum = is_enum<_Tp>::value>
    class __make_unsigned_selector;
    class __make_unsigned_selector;
  template
  template
    class __make_unsigned_selector<_Tp, true, false>
    class __make_unsigned_selector<_Tp, true, false>
    {
    {
      typedef __make_unsigned::type> __unsignedt;
      typedef __make_unsigned::type> __unsignedt;
      typedef typename __unsignedt::__type __unsigned_type;
      typedef typename __unsignedt::__type __unsigned_type;
      typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
      typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
    public:
    public:
      typedef typename __cv_unsigned::__type __type;
      typedef typename __cv_unsigned::__type __type;
    };
    };
  template
  template
    class __make_unsigned_selector<_Tp, false, true>
    class __make_unsigned_selector<_Tp, false, true>
    {
    {
      // With -fshort-enums, an enum may be as small as a char.
      // With -fshort-enums, an enum may be as small as a char.
      typedef unsigned char __smallest;
      typedef unsigned char __smallest;
      static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
      static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
      static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
      static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
      static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
      static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
      typedef conditional<__b2, unsigned int, unsigned long> __cond2;
      typedef conditional<__b2, unsigned int, unsigned long> __cond2;
      typedef typename __cond2::type __cond2_type;
      typedef typename __cond2::type __cond2_type;
      typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
      typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
      typedef typename __cond1::type __cond1_type;
      typedef typename __cond1::type __cond1_type;
    public:
    public:
      typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
      typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
    };
    };
  // Given an integral/enum type, return the corresponding unsigned
  // Given an integral/enum type, return the corresponding unsigned
  // integer type.
  // integer type.
  // Primary template.
  // Primary template.
  /// make_unsigned
  /// make_unsigned
  template
  template
    struct make_unsigned
    struct make_unsigned
    { typedef typename __make_unsigned_selector<_Tp>::__type type; };
    { typedef typename __make_unsigned_selector<_Tp>::__type type; };
  // Integral, but don't define.
  // Integral, but don't define.
  template<>
  template<>
    struct make_unsigned;
    struct make_unsigned;
  // Utility for finding the signed versions of unsigned integral types.
  // Utility for finding the signed versions of unsigned integral types.
  template
  template
    struct __make_signed
    struct __make_signed
    { typedef _Tp __type; };
    { typedef _Tp __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed char __type; };
    { typedef signed char __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed char __type; };
    { typedef signed char __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed short __type; };
    { typedef signed short __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed int __type; };
    { typedef signed int __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed long __type; };
    { typedef signed long __type; };
  template<>
  template<>
    struct __make_signed
    struct __make_signed
    { typedef signed long long __type; };
    { typedef signed long long __type; };
  // Select between integral and enum: not possible to be both.
  // Select between integral and enum: not possible to be both.
  template
  template
           bool _IsInt = is_integral<_Tp>::value,
           bool _IsInt = is_integral<_Tp>::value,
           bool _IsEnum = is_enum<_Tp>::value>
           bool _IsEnum = is_enum<_Tp>::value>
    class __make_signed_selector;
    class __make_signed_selector;
  template
  template
    class __make_signed_selector<_Tp, true, false>
    class __make_signed_selector<_Tp, true, false>
    {
    {
      typedef __make_signed::type> __signedt;
      typedef __make_signed::type> __signedt;
      typedef typename __signedt::__type __signed_type;
      typedef typename __signedt::__type __signed_type;
      typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
      typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
    public:
    public:
      typedef typename __cv_signed::__type __type;
      typedef typename __cv_signed::__type __type;
    };
    };
  template
  template
    class __make_signed_selector<_Tp, false, true>
    class __make_signed_selector<_Tp, false, true>
    {
    {
      // With -fshort-enums, an enum may be as small as a char.
      // With -fshort-enums, an enum may be as small as a char.
      typedef signed char __smallest;
      typedef signed char __smallest;
      static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
      static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
      static const bool __b1 = sizeof(_Tp) <= sizeof(signed short);
      static const bool __b1 = sizeof(_Tp) <= sizeof(signed short);
      static const bool __b2 = sizeof(_Tp) <= sizeof(signed int);
      static const bool __b2 = sizeof(_Tp) <= sizeof(signed int);
      typedef conditional<__b2, signed int, signed long> __cond2;
      typedef conditional<__b2, signed int, signed long> __cond2;
      typedef typename __cond2::type __cond2_type;
      typedef typename __cond2::type __cond2_type;
      typedef conditional<__b1, signed short, __cond2_type> __cond1;
      typedef conditional<__b1, signed short, __cond2_type> __cond1;
      typedef typename __cond1::type __cond1_type;
      typedef typename __cond1::type __cond1_type;
    public:
    public:
      typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
      typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
    };
    };
  // Given an integral/enum type, return the corresponding signed
  // Given an integral/enum type, return the corresponding signed
  // integer type.
  // integer type.
  // Primary template.
  // Primary template.
  /// make_signed
  /// make_signed
  template
  template
    struct make_signed
    struct make_signed
    { typedef typename __make_signed_selector<_Tp>::__type type; };
    { typedef typename __make_signed_selector<_Tp>::__type type; };
  // Integral, but don't define.
  // Integral, but don't define.
  template<>
  template<>
    struct make_signed;
    struct make_signed;
  /// common_type
  /// common_type
  template
  template
    struct common_type;
    struct common_type;
  template
  template
    struct common_type<_Tp>
    struct common_type<_Tp>
    { typedef _Tp type; };
    { typedef _Tp type; };
  template
  template
    struct common_type<_Tp, _Up>
    struct common_type<_Tp, _Up>
    { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
    { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
  template
  template
    struct common_type<_Tp, _Up, _Vp...>
    struct common_type<_Tp, _Up, _Vp...>
    {
    {
      typedef typename
      typedef typename
        common_type::type, _Vp...>::type type;
        common_type::type, _Vp...>::type type;
    };
    };
  // @} group metaprogramming
  // @} group metaprogramming
  /// declval
  /// declval
  template
  template
    struct __declval_protector
    struct __declval_protector
    {
    {
      static const bool __stop = false;
      static const bool __stop = false;
      static typename add_rvalue_reference<_Tp>::type __delegate();
      static typename add_rvalue_reference<_Tp>::type __delegate();
    };
    };
  template
  template
    inline typename add_rvalue_reference<_Tp>::type
    inline typename add_rvalue_reference<_Tp>::type
    declval()
    declval()
    {
    {
      static_assert(__declval_protector<_Tp>::__stop,
      static_assert(__declval_protector<_Tp>::__stop,
                    "declval() must not be used!");
                    "declval() must not be used!");
      return __declval_protector<_Tp>::__delegate();
      return __declval_protector<_Tp>::__delegate();
    }
    }
}
}
#endif  // __GXX_EXPERIMENTAL_CXX0X__
#endif  // __GXX_EXPERIMENTAL_CXX0X__
#endif  // _GLIBCXX_TYPE_TRAITS
#endif  // _GLIBCXX_TYPE_TRAITS
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.