diff --git a/include/boost/detail/ob_type_traits.hpp b/include/boost/detail/ob_type_traits.hpp deleted file mode 100644 index 8be87ec..0000000 --- a/include/boost/detail/ob_type_traits.hpp +++ /dev/null @@ -1,609 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. - -// See http://www.boost.org for most recent version including documentation. -// -// Crippled version of type traits for compilers that don't -// support partial specialisation. (C) John Maddock 2000 - -/* Release notes: - 20 Jan 2001: - Fixed is_same so it would work with T == void or U == void - Suppressed some warnings in from_not_void_conversion<> for MSVC - Fixed a spelling error - (David Abrahams) - 07 Oct 2000: - Added more fixes for is_array (based on a newgroup posting by Jonathan Lundquist). - 03 Oct 2000: - Added more fixes to is_pointer and is_array (JM). - 01st October 2000: - Fixed is_pointer, is_reference, is_const, is_volatile, is_same, is_member_pointer - using ideas suggested from "Generic: Mappings between Types and Values" - by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). - Mat Marcus and Jesse Jones posted a version of is_pointer very similar to this one - on the boost list (Copyright 2000 Adobe Systems Incorporated and others. - All rights reserved.). - 31st July 2000: - Added is_convertible, alignment_of. - 23rd July 2000: - Fixed is_void specialization. (JM) -*/ - -// -// partial copyright for is_convertible: -// -// Copyright (C) 2000 Jeremy Siek (jsiek@lsc.nd.edu) -// Copyright (C) 1999, 2000 Jaakko J„rvi (jaakko.jarvi@cs.utu.fi) -// -// Permission to copy and use this software is granted, -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted, -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. - -#ifndef BOOST_OB_TYPE_TRAITS_HPP -#define BOOST_OB_TYPE_TRAITS_HPP - -#include - -#ifndef BOOST_TYPE_TRAITS_HPP -#error Internal header file: This header must be included by only. -#endif - -// ************************************************************************** -// Helper macros for builitin compiler support. -// If your compiler has builtin support for any of the following -// traits concepts, then redefine the appropriate macros to pick -// up on the compiler support: - -#define BOOST_IS_CLASS(T) !is_union::value & \ - !is_scalar::value & \ - !is_array::value & \ - !is_reference::value & \ - !is_void::value -#define BOOST_IS_ENUM(T) false -#define BOOST_IS_UNION(T) false -#define BOOST_IS_POD(T) false -#define BOOST_IS_EMPTY(T) false -#define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false -#define BOOST_HAS_TRIVIAL_COPY(T) false -#define BOOST_HAS_TRIVIAL_ASSIGN(T) false -#define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false - - -/**************************************************************************/ - -namespace boost{ -// -// start with fundamental type operations: -// these don't actually work: -// -template -struct remove_volatile{ typedef T type; }; -template -struct remove_const{ typedef T type; }; -template -struct remove_cv{ typedef T type; }; -template struct remove_reference{ typedef T type; }; -template struct add_reference{ typedef T& type; }; -template struct remove_bounds{ typedef T type; }; - -/**************************************************************************/ -// -// fundamental property classes: - -//* is a type T declared const - is_const -namespace detail{ - typedef char yes_result; - typedef char (&no_result)[8]; - yes_result is_const_helper(const volatile void*); - no_result is_const_helper(volatile void *); - yes_result is_volatile_helper(const volatile void*); - no_result is_volatile_helper(const void *); -} - -template -struct is_const -{ -private: - static T t; -public: - enum{ value = (sizeof(detail::yes_result) == sizeof(detail::is_const_helper(&t))) }; -}; - -template -struct is_volatile -{ -private: - static T t; -public: - enum{ value = (sizeof(detail::yes_result) == sizeof(detail::is_volatile_helper(&t))) }; -}; - -namespace detail{ - template - yes_result is_same_helper(T*, T*); - no_result is_same_helper(...); - - template - struct size_of - { - enum { value = sizeof(T) }; - }; - - template <> - struct size_of - { - enum { value = 0 }; - }; -} - -template struct is_reference; -template struct is_same -{ -private: - static type t; - static type u; -public: - enum{ value = (sizeof(detail::yes_result) == sizeof(detail::is_same_helper(&t,&u))) - & (is_reference::value == is_reference::value) - & (detail::size_of::value == detail::size_of::value) }; -}; - -template struct is_void{ enum{ value = false }; }; -template <> struct is_void{ enum{ value = true }; }; - -//* is a type T an unsigned integral type described in the standard (3.9.1p3) -template struct is_standard_unsigned_integral -{ enum{ value = false}; }; -template <> struct is_standard_unsigned_integral -{ enum{ value = true}; }; -template <> struct is_standard_unsigned_integral -{ enum{ value = true}; }; -template <> struct is_standard_unsigned_integral -{ enum{ value = true}; }; -template <> struct is_standard_unsigned_integral -{ enum{ value = true}; }; - -//* is a type T a signed integral type described in the standard (3.9.1p2) -template struct is_standard_signed_integral -{ enum{ value = false}; }; -template <> struct is_standard_signed_integral -{ enum{ value = true}; }; -template <> struct is_standard_signed_integral -{ enum{ value = true}; }; -template <> struct is_standard_signed_integral -{ enum{ value = true}; }; -template <> struct is_standard_signed_integral -{ enum{ value = true}; }; - -//* is a type T an integral type described in the standard (3.9.1p7) -template struct is_standard_integral -{ enum{ value = is_standard_unsigned_integral::value | -is_standard_signed_integral::value }; }; -template <> struct is_standard_integral -{ enum{ value = true}; }; -template <> struct is_standard_integral -{ enum{ value = true}; }; -template <> struct is_standard_integral -{ enum{ value = true}; }; - -//* is a type T a floating-point type described in the standard (3.9.1p8) -template struct is_standard_float -{ enum{ value = false}; }; -template <> struct is_standard_float -{ enum{ value = true}; }; -template <> struct is_standard_float -{ enum{ value = true}; }; -template <> struct is_standard_float -{ enum{ value = true}; }; - -//* is a type T an arithmetic type described in the standard (3.9.1p8) -template struct is_standard_arithmetic -{ enum{ value = is_standard_integral::value | is_standard_float::value}; }; - -//* is a type T a fundamental type described in the standard (3.9.1) -template struct is_standard_fundamental -{ enum{ value = is_standard_arithmetic::value | is_void::value}; }; - -//* is a type T an unsigned integral type provided by a compiler extension -// specialise for compiler defined extentions: -template struct is_extension_unsigned_integral -{ enum{ value = false}; }; - -//* is a type T a signed integral type provided by a compiler extension -// specialise for compiler defined extentions: -template struct is_extension_signed_integral -{ enum{ value = false}; }; - -#ifdef ULLONG_MAX -template <> struct is_extension_unsigned_integral -{ enum{ value = true}; }; -template <> struct is_extension_signed_integral -{ enum{ value = true}; }; -#endif -#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) -template <> struct is_extension_unsigned_integral -{ enum{ value = true}; }; -template <> struct is_extension_signed_integral<__int64> -{ enum{ value = true}; }; -#endif - -//* is a type T an integral type provided by a compiler extension -template struct is_extension_integral -{ enum{ value = is_extension_signed_integral::value | - is_extension_unsigned_integral::value }; }; - -//* is a type T a floating-point type provided by a compiler extension -template struct is_extension_float -{ enum{ value = false}; }; - -//* is a type T an arithmetic type provided by a compiler extension -template struct is_extension_arithmetic -{ enum{ value = is_extension_integral::value | is_extension_float::value}; }; - -//* is a type T a fundamental type provided by a compiler extension -template struct is_extension_fundamental -{ enum{ value = is_extension_arithmetic::value | is_void::value}; }; - -//* is a type T an unsigned integral type provided by the compiler or standard -template struct is_unsigned_integral -{ enum{ value = is_standard_unsigned_integral::value | is_extension_unsigned_integral::value}; }; - -//* is a type T a signed integral type provided by the compiler or standard -template struct is_signed_integral -{ enum{ value = is_standard_signed_integral::value | is_extension_signed_integral::value}; }; - -//* is a type T an integral type provided by the compiler or standard -template struct is_integral -{ enum{ value = is_standard_integral::value | is_extension_integral::value}; }; - -//* is a type T a floating-point type provided by the compiler or standard -template struct is_float -{ enum{ value = is_standard_float::value | is_extension_float::value}; }; - -//* is a type T an arithmetic type provided by the compiler or standard -template struct is_arithmetic -{ enum{ value = is_standard_arithmetic::value | is_extension_arithmetic::value}; }; - -//* is a type T a fundamental type provided by the compiler or standard -template struct is_fundamental -{ enum{ value = is_standard_fundamental::value | is_extension_fundamental::value}; }; - -//* is a type T an array - is_array -namespace detail{ - struct pointer_helper - { - pointer_helper(const volatile void*); - }; - yes_result is_pointer_helper(pointer_helper); - no_result is_pointer_helper(...); - template - yes_result is_pointer_helper3(T (*)(void)); - template - yes_result is_pointer_helper3(T (*)(A1)); - template - yes_result is_pointer_helper3(T (*)(A1, A2)); - template - yes_result is_pointer_helper3(T (*)(A1, A2, A3)); - no_result is_pointer_helper3(...); - - yes_result is_array_helper(const volatile void*, const volatile void*); - template - no_result is_array_helper(T**, const volatile void*); - no_result is_array_helper(...); -} -template struct is_array -{ -private: - static T t; -public: - enum{ value = (1 == sizeof(detail::is_pointer_helper(t))) - & (1 == sizeof(detail::is_array_helper(&t, t))) - & !is_reference::value - & !(1 == sizeof(detail::is_pointer_helper3(t))) }; -}; - -//* is a type T a pointer type (including function pointers) - is_pointer -template struct is_pointer -{ -private: - static T t; -public: - enum{ value = (!is_const::value - & !is_volatile::value - & !is_reference::value - & !is_array::value) - & ((1 == sizeof(detail::is_pointer_helper(t))) - | (1 == sizeof(detail::is_pointer_helper3(t)))) }; -}; - -# ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4181) -# endif // BOOST_MSVC - -//* is a type T a reference type - is_reference -template struct is_reference -{ -private: - typedef T const volatile cv_t; -public: - enum // dwa 10/27/00 - VC6.4 seems to choke on short-circuit (&&,||) - { // evaluations in constant expressions - value = !is_const::value | !is_volatile::value - }; -}; -template <> struct is_reference -{ - enum{ value = false }; -}; - -# ifdef BOOST_MSVC -# pragma warning(pop) -# endif // BOOST_MSVC - -//*? is a type T a union type - is_union -template struct is_union -{ enum{ value = BOOST_IS_UNION(T) }; }; - -//*? is a type T an enum - is_enum -template struct is_enum -{ enum{ value = BOOST_IS_ENUM(T) }; }; - -//* is a type T a member function pointer - is_member_pointer -namespace detail{ - template - yes_result is_member_pointer_helper(T (U::*)); - template - yes_result is_member_pointer_helper(T (U::*)(void)); - template - yes_result is_member_pointer_helper(T (U::*)(A1)); - template - yes_result is_member_pointer_helper(T (U::*)(A1, A2)); - no_result is_member_pointer_helper(...); -} -template struct is_member_pointer -{ -private: - static T t; -public: - enum{ value = (1 == sizeof(detail::is_member_pointer_helper(t))) }; -}; - -//* is type T an object type (allows cv-qual) -template struct is_object -{ enum{ value = !is_reference::value & !is_void::value }; }; - -//* is type T a standard scalar type (allows cv-qual) -template struct is_standard_scalar -{ enum{ value = is_standard_arithmetic::value - | is_enum::value - | is_pointer::value - | is_member_pointer::value }; }; - -//* is type T an extension scalar type (allows cv-qual) -template struct is_extension_scalar -{ enum{ value = is_extension_arithmetic::value - | is_enum::value - | is_pointer::value - | is_member_pointer::value }; }; - -//* is type T a builtin scalar type (allows cv-qual) -template struct is_scalar -{ enum{ value = is_arithmetic::value - | is_enum::value - | is_pointer::value - | is_member_pointer::value }; }; - -//*? is a type T a class type (class/struct) - is_class -template struct is_class -{ enum{ value = BOOST_IS_CLASS(T) }; }; - -//*? is a type T a compound type -template struct is_compound -{ enum{ value = is_array::value | is_pointer::value - | is_reference::value | is_class::value | is_union::value - | is_enum::value | is_member_pointer::value }; }; - -//*? is type T a POD type (allows cv-qual) -template struct is_POD -{ enum{ value = is_scalar::value //JM 7Jan2000 - | BOOST_IS_POD(T) }; }; - -namespace detail{ - - // This workaround is necessary to handle when From is void - // which is normally taken care of by the partial specialization - // of the is_convertible class. -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES - struct from_not_void_conversion { - template - struct bind { - static no_result check(...); - static yes_result check(To); - public: - void foo(); // avoid warning about all members being private - static From from; -# ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable:4244 4245 4135 4136 4051 4134) // disable all conversion warnings -# endif - enum { exists = sizeof( check(from) ) == sizeof(yes_result) }; -# ifdef BOOST_MSVC -# pragma warning(pop) -# endif - }; - }; - struct from_is_void_conversion { - template - struct bind { - enum { exists = is_void::value }; - }; - }; - - template - struct conversion_helper { - typedef from_not_void_conversion type; - }; - template <> - struct conversion_helper { - typedef from_is_void_conversion type; - }; -#endif -} // namespace detail - -template -class is_convertible -{ -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES - typedef typename detail::conversion_helper::type Selector; - typedef Selector::template bind Conversion; -public: - enum { value = Conversion::exists }; -#else - static detail::no_result check(...); - static detail::yes_result check(To); - public: - void foo(); // avoid warning about all members being private - static From from; - enum { value = sizeof( check(from) ) == sizeof(detail::yes_result) }; -#endif -}; - -template -class alignment_of -{ - struct padded - { - char c; - T t; - padded(); - }; -public: - enum{ value = sizeof(padded) - sizeof(T) }; -}; - -//*? is type T an empty composite type (allows cv-qual) -#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) - -namespace detail{ - -template -struct empty_helper_t1 : public T -{ - int i[256]; -}; -struct empty_helper_t2 { int i[256]; }; - -template -struct empty_helper_base -{ - enum{ value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)) }; -}; - -template -struct empty_helper_nonbase -{ - enum{ value = false }; -}; - -template -struct empty_helper_chooser -{ - template - struct rebind - { - typedef empty_helper_nonbase type; - }; -}; - -template <> -struct empty_helper_chooser -{ - template - struct rebind - { - typedef empty_helper_base type; - }; -}; - -} // namespace detail - -template -struct is_empty -{ -private: - typedef detail::empty_helper_chooser< - !is_convertible::value - & !is_convertible::value - & !is_pointer::value - & !is_member_pointer::value - & !is_array::value - & !is_convertible::value> chooser; - typedef typename chooser::template rebind bound_type; - typedef typename bound_type::type eh_type; -public: - enum{ value = eh_type::value | BOOST_IS_EMPTY(T) }; -}; - -#else -template struct is_empty -{ enum{ value = BOOST_IS_EMPTY(T) }; }; -#endif - -//*? T has trivial default constructor (allows cv-qual) -template struct has_trivial_constructor -{ - enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) }; -}; - -//*? T has trivial copy constructor (allows cv-qual) -template struct has_trivial_copy -{ - enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_COPY(T) }; -}; - -//*? T has trivial assignment operator (allows cv-qual) -template -struct has_trivial_assign -{ - enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_ASSIGN(T) }; -}; - -//*? T has trivial destructor (allows cv-qual) -template -struct has_trivial_destructor -{ - enum{ value = is_POD::value | BOOST_HAS_TRIVIAL_DESTRUCTOR(T) }; -}; - -} // namespace boost - -/**************************************************************************/ - -// -// undefine helper macro's: -// -#undef BOOST_IS_CLASS -#undef BOOST_IS_ENUM -#undef BOOST_IS_UNION -#undef BOOST_IS_POD -#undef BOOST_IS_EMPTY -#undef BOOST_HAS_TRIVIAL_CONSTRUCTOR -#undef BOOST_HAS_TRIVIAL_COPY -#undef BOOST_HAS_TRIVIAL_ASSIGN -#undef BOOST_HAS_TRIVIAL_DESTRUCTOR - -#endif // BOOST_OB_TYPE_TRAITS_HPP - - - - - diff --git a/include/boost/detail/type_traits.hpp b/include/boost/detail/type_traits.hpp deleted file mode 100644 index 76954c6..0000000 --- a/include/boost/detail/type_traits.hpp +++ /dev/null @@ -1,675 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. - -// See http://www.boost.org for most recent version including documentation. -// -// misc traits classes that operate on or describe a type. -// see libs/utility/type_traits.htm - -/* Release notes: - 31 Jan 2001: - Fixed is_convertible warning for g++. Added specialization of - is_array to handle the const array case. Added parenthesis are - body of BOOST_IS_CLASS to prevent macro mistakes. (Jeremy Siek) - 21 Jan 2001: - Fixed tests for long long to detect its presence on GCC (David Abrahams) - 03 Oct 2000: - Added gcc specific fixes for memeber pointers (JM). - 31st July 2000: - Added is_convertable, alignment_of, modified is_empty. - 23rd July 2000: - Added Borland specific fixes for reference types (Steve Cleary). -*/ - -// -// partial copyright for is_convertible: -// -// Copyright (C) 2000 Jeremy Siek (jsiek@lsc.nd.edu) -// Copyright (C) 1999, 2000 Jaakko J„rvi (jaakko.jarvi@cs.utu.fi) -// -// Permission to copy and use this software is granted, -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted, -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. - - -#ifndef BOOST_DETAIL_TYPE_TRAITS_HPP -#define BOOST_DETAIL_TYPE_TRAITS_HPP - -#ifndef BOOST_TYPE_TRAITS_HPP -#error Internal header file: This header must be included by only. -#endif - -#include -#include - -// -// Helper macros for builitin compiler support. -// If your compiler has builtin support for any of the following -// traits concepts, then redefine the appropriate macros to pick -// up on the compiler support: -// -// (these should return false if T is cv-qualified; the type traits that use these -// will strip cv-qualification if necessary before passing T) -// BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type -// BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type -// BOOST_IS_UNION(T) should evaluate to true if T is a union type -// BOOST_IS_POD(T) should evaluate to true if T is a POD type -// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union -// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect -// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy -// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy -// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect - -#define BOOST_IS_CLASS(T) (!is_union::value && \ - !is_scalar::value && \ - !is_array::value && \ - !is_reference::value && \ - !is_void::value) -#define BOOST_IS_ENUM(T) false -#define BOOST_IS_UNION(T) false -#define BOOST_IS_POD(T) false -#define BOOST_IS_EMPTY(T) false -#define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false -#define BOOST_HAS_TRIVIAL_COPY(T) false -#define BOOST_HAS_TRIVIAL_ASSIGN(T) false -#define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false - - -/**************************************************************************/ - -namespace boost{ -// -// start with fundamental type operations: - -namespace details { -// -// implementation helper: -// -template -struct cv_traits_imp{}; - -template -struct cv_traits_imp -{ - static const bool is_const = false; - static const bool is_volatile = false; - typedef T non_const_type; - typedef T non_volatile_type; - typedef T unqualified_type; - static const char* what() { return ""; } -}; - -template -struct cv_traits_imp -{ - static const bool is_const = true; - static const bool is_volatile = false; - typedef T non_const_type; - typedef const T non_volatile_type; - typedef T unqualified_type; - static const char* what() { return "const"; } -}; - -template -struct cv_traits_imp -{ - static const bool is_const = false; - static const bool is_volatile = true; - typedef volatile T non_const_type; - typedef T non_volatile_type; - typedef T unqualified_type; - static const char* what() { return "volatile"; } -}; - -template -struct cv_traits_imp -{ - static const bool is_const = true; - static const bool is_volatile = true; - typedef volatile T non_const_type; - typedef const T non_volatile_type; - typedef T unqualified_type; - static const char* what() { return "const volatile"; } -}; - -} // namespace details - -// * convert a type T to a non-volatile type - remove_volatile -template -struct remove_volatile -{ - typedef typename details::cv_traits_imp::non_volatile_type type; -}; -template struct remove_volatile{ typedef T& type; }; - -// * convert a type T to non-const type - remove_const -template -struct remove_const -{ - typedef typename details::cv_traits_imp::non_const_type type; -}; -template struct remove_const{ typedef T& type; }; - -// convert a type T to a non-cv-qualified type - remove_cv -template -struct remove_cv -{ - typedef typename details::cv_traits_imp::unqualified_type type; -}; -template struct remove_cv{ typedef T& type; }; - -// * convert a type T to a non-reference if it is one - remove_reference -template struct remove_reference{ typedef T type; }; -template struct remove_reference{ typedef T type; }; -#if (defined(__BORLANDC__) && (__BORLANDC__ <= 0x550)) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -template struct remove_reference{ typedef T type; }; -template struct remove_reference{ typedef T type; }; -template struct remove_reference{ typedef T type; }; -#endif -// * convert a type T to a reference unless it is one - add_reference -template struct add_reference{ typedef T& type; }; -template struct add_reference{ typedef T& type; }; - -// * convert an array type to underlying non-array type - remove_bounds -template struct remove_bounds{ typedef T type; }; -template struct remove_bounds{ typedef T type; }; - -/**************************************************************************/ -// -// fundamental property classes: - -//* is a type T declared const - is_const -template -struct is_const -{ - static const bool value = details::cv_traits_imp::is_const; -}; - -//* is a type T declared volatile - is_volatile -template -struct is_volatile -{ - static const bool value = details::cv_traits_imp::is_volatile; -}; - -//* is a type T the same as type U - is_same -template struct is_same { static const bool value = false; }; -template struct is_same { static const bool value = true; }; - -//* is a type T void - is_void -template struct is_void{ static const bool value = false; }; -template <> struct is_void{ static const bool value = true; }; - -//* is a type T an unsigned integral type described in the standard (3.9.1p3) -template struct is_standard_unsigned_integral -{ static const bool value = false; }; -template <> struct is_standard_unsigned_integral -{ static const bool value = true; }; -template <> struct is_standard_unsigned_integral -{ static const bool value = true; }; -template <> struct is_standard_unsigned_integral -{ static const bool value = true; }; -template <> struct is_standard_unsigned_integral -{ static const bool value = true; }; - -//* is a type T a signed integral type described in the standard (3.9.1p2) -template struct is_standard_signed_integral -{ static const bool value = false; }; -template <> struct is_standard_signed_integral -{ static const bool value = true; }; -template <> struct is_standard_signed_integral -{ static const bool value = true; }; -template <> struct is_standard_signed_integral -{ static const bool value = true; }; -template <> struct is_standard_signed_integral -{ static const bool value = true; }; - -//* is a type T an integral type described in the standard (3.9.1p7) -template struct is_standard_integral -{ static const bool value = is_standard_unsigned_integral::value || - is_standard_signed_integral::value; }; -template <> struct is_standard_integral -{ static const bool value = true; }; -template <> struct is_standard_integral -{ static const bool value = true; }; -template <> struct is_standard_integral -{ static const bool value = true; }; - -//* is a type T a floating-point type described in the standard (3.9.1p8) -template struct is_standard_float -{ static const bool value = false; }; -template <> struct is_standard_float -{ static const bool value = true; }; -template <> struct is_standard_float -{ static const bool value = true; }; -template <> struct is_standard_float -{ static const bool value = true; }; - -//* is a type T an arithmetic type described in the standard (3.9.1p8) -template struct is_standard_arithmetic -{ static const bool value = is_standard_integral::value || is_standard_float::value; }; - -//* is a type T a fundamental type described in the standard (3.9.1) -template struct is_standard_fundamental -{ static const bool value = is_standard_arithmetic::value || is_void::value; }; - -//* is a type T an unsigned integral type provided by a compiler extension -// specialise for compiler defined extentions: -template struct is_extension_unsigned_integral -{ static const bool value = false; }; - -//* is a type T a signed integral type provided by a compiler extension -// specialise for compiler defined extentions: -template struct is_extension_signed_integral -{ static const bool value = false; }; - -#if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) -template <> struct is_extension_unsigned_integral -{ static const bool value = true; }; -template <> struct is_extension_signed_integral -{ static const bool value = true; }; -#endif -#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) -template <> struct is_extension_unsigned_integral -{ static const bool value = true; }; -template <> struct is_extension_signed_integral<__int64> -{ static const bool value = true; }; -#endif - -//* is a type T an integral type provided by a compiler extension -template struct is_extension_integral -{ static const bool value = is_extension_signed_integral::value || - is_extension_unsigned_integral::value; }; - -//* is a type T a floating-point type provided by a compiler extension -template struct is_extension_float -{ static const bool value = false; }; - -//* is a type T an arithmetic type provided by a compiler extension -template struct is_extension_arithmetic -{ static const bool value = is_extension_integral::value || is_extension_float::value; }; - -//* is a type T a fundamental type provided by a compiler extension -template struct is_extension_fundamental -{ static const bool value = is_extension_arithmetic::value || is_void::value; }; - -//* is a type T an unsigned integral type provided by the compiler or standard -template struct is_unsigned_integral -{ static const bool value = is_standard_unsigned_integral::value || is_extension_unsigned_integral::value; }; - -//* is a type T a signed integral type provided by the compiler or standard -template struct is_signed_integral -{ static const bool value = is_standard_signed_integral::value || is_extension_signed_integral::value; }; - -//* is a type T an integral type provided by the compiler or standard -template struct is_integral -{ static const bool value = is_standard_integral::value || is_extension_integral::value; }; - -//* is a type T a floating-point type provided by the compiler or standard -template struct is_float -{ static const bool value = is_standard_float::value || is_extension_float::value; }; - -//* is a type T an arithmetic type provided by the compiler or standard -template struct is_arithmetic -{ static const bool value = is_standard_arithmetic::value || is_extension_arithmetic::value; }; - -//* is a type T a fundamental type provided by the compiler or standard -template struct is_fundamental -{ static const bool value = is_standard_fundamental::value || is_extension_fundamental::value; }; - -//* is a type T an array - is_array -template struct is_array -{ static const bool value = false; }; -template struct is_array -{ static const bool value = true; }; -template struct is_array -{ static const bool value = true; }; - -//* is a type T a pointer type (including function pointers) - is_pointer -template struct is_pointer { static const bool value = false; }; -template struct is_pointer { static const bool value = true; }; -#ifdef __GNUC__ -// gcc workarounds: these partial specialisations should not be needed: -template struct is_pointer -{ static const bool value = false; }; -template struct is_pointer -{ static const bool value = false; }; -template struct is_pointer -{ static const bool value = false; }; -template struct is_pointer -{ static const bool value = false; }; -#endif - -//* is a type T a reference type - is_reference -template struct is_reference { static const bool value = false; }; -template struct is_reference { static const bool value = true; }; -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -template struct is_reference { static const bool value = true; }; -template struct is_reference { static const bool value = true; }; -template struct is_reference { static const bool value = true; }; -#endif - -//*? is a type T a union type - is_union -template struct is_union -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = BOOST_IS_UNION(cvt); -}; - -//*? is a type T an enum - is_enum -template struct is_enum -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = BOOST_IS_ENUM(cvt); -}; - -//* is a type T a member function pointer - is_member_pointer -template struct is_member_pointer -{ static const bool value = false; }; -template struct is_member_pointer -{ static const bool value = true; }; -#ifdef __GNUC__ -// gcc workaround (JM 02 Oct 2000) -template struct is_member_pointer -{ static const bool value = true; }; -template struct is_member_pointer -{ static const bool value = true; }; -template struct is_member_pointer -{ static const bool value = true; }; -#endif - -//* is type T an object type (allows cv-qual) -template struct is_object -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = !::boost::is_reference::value - && !::boost::is_void::value; -}; - -//* is type T a standard scalar type (allows cv-qual) -template struct is_standard_scalar -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_standard_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value; -}; - -//* is type T an extension scalar type (allows cv-qual) -template struct is_extension_scalar -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_extension_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value; -}; - -//* is type T a builtin scalar type (allows cv-qual) -template struct is_scalar -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_arithmetic::value - || is_enum::value - || is_pointer::value - || is_member_pointer::value; -}; - -//*? is a type T a class type (class/struct) - is_class -template struct is_class -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = BOOST_IS_CLASS(cvt); -}; - -//*? is a type T a compound type -template struct is_compound -{ static const bool value = is_array::value || is_pointer::value - || is_reference::value || is_class::value || is_union::value - || is_enum::value || is_member_pointer::value; }; - -//*? is type T a POD type (allows cv-qual) -template struct is_POD -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_scalar::value || BOOST_IS_POD(cvt); -}; -template struct is_POD -{ static const bool value = is_POD::value; }; - -// -// Thanks to Andrei Alexandrescu for the original version of this -// conversion class! -// -// is one type convertable to another? -template -struct is_convertible -{ -private: - typedef char (&no)[1]; - typedef char (&yes)[2]; - // The workarounds for Borland and GNU C++ break the EDG C++ frontend, - // so we only use them for those compilers. -#if defined(__GNUC__) - struct accept_any { - template accept_any(const T&); - }; - template - struct checker - { - // Need two arguments in the check functions to bias resolution - // towards the "yes" in the case when the From type has an implicit - // conversion operator defined for the To type, which would - // otherwise be an ambiguous situation. - static no check(accept_any, accept_any); - static yes check(T, From); - }; - static From from; -public: - static const bool value = - sizeof( checker::check(from, from) ) == sizeof(yes); -#elif defined(__BORLANDC__) - template - struct checker - { - static no check(...); - static yes check(T); - }; - static From from; -public: - static const bool value = sizeof( checker::check(from) ) == sizeof(yes); -# else // not __BORLANDC__ or __GNUC__ - static no check(...); - static yes check(To); - static From from; -public: - static const bool value = sizeof( check(from) ) == sizeof(yes); -# endif - void foo(); // avoid warning about all members being private -}; - -template -struct is_convertible -{ - static const bool value = false; -}; -template -struct is_convertible -{ - static const bool value = false; -}; -template <> -struct is_convertible -{ - static const bool value = true; -}; -// -// get the alignment of some arbitrary type: -namespace detail{ -// hack for MWCW: -template -class alignment_of_hack -{ - char c; - T t; - alignment_of_hack(); -}; -} -template -class alignment_of -{ -public: - static const unsigned value = sizeof(detail::alignment_of_hack) - sizeof(T); -}; -// -// references have to be treated specially, assume -// that a reference is just a special pointer: -template -class alignment_of -{ -public: - static const unsigned value = alignment_of::value; -}; - -// -// JM 7Jan2000 -// -namespace detail{ -template -struct empty_helper{ static const bool value = false; }; - -template -struct empty_helper_t1 : public T -{ -#ifdef __MWERKS__ - empty_helper_t1(); // hh compiler bug workaround -#endif - int i[256]; -}; -struct empty_helper_t2 { int i[256]; }; - -template -struct empty_helper -{ - static const bool value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)); -}; -} - -//*? is type T an empty composite type (allows cv-qual) -template struct is_empty -{ -private: - typedef typename remove_cv::type cvt; -public: -#ifdef __GNUC__ - // is_convertible gives a warning for g++ - static const bool value = ::boost::detail::empty_helper::value , false>::value - || BOOST_IS_EMPTY(cvt); - -#else - static const bool value = ::boost::detail::empty_helper::value , is_convertible::value>::value - || BOOST_IS_EMPTY(cvt); -#endif -}; - -//*? T has trivial default constructor (allows cv-qual) -template struct has_trivial_constructor -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_POD::value - || BOOST_HAS_TRIVIAL_CONSTRUCTOR(cvt); -}; - -//*? T has trivial copy constructor (allows cv-qual) -template struct has_trivial_copy -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_POD::value - || BOOST_HAS_TRIVIAL_COPY(cvt); -}; - -//*? T has trivial assignment operator (allows cv-qual) -template -struct has_trivial_assign -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_POD::value - || BOOST_HAS_TRIVIAL_ASSIGN(cvt); -}; - -//*? T has trivial destructor (allows cv-qual) -template -struct has_trivial_destructor -{ -private: - typedef typename remove_cv::type cvt; -public: - static const bool value = is_POD::value - || BOOST_HAS_TRIVIAL_DESTRUCTOR(cvt); -}; - -} // namespace boost - -/**************************************************************************/ - -// -// undefine helper macro's: -// -#undef BOOST_IS_CLASS -#undef BOOST_IS_ENUM -#undef BOOST_IS_UNION -#undef BOOST_IS_POD -#undef BOOST_IS_EMPTY -#undef BOOST_HAS_TRIVIAL_CONSTRUCTOR -#undef BOOST_HAS_TRIVIAL_COPY -#undef BOOST_HAS_TRIVIAL_ASSIGN -#undef BOOST_HAS_TRIVIAL_DESTRUCTOR - -#endif // BOOST_DETAIL_TYPE_TRAITS_HPP - - - - - - - -