1 // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
2 // Permission to copy, use, modify, sell and
3 // distribute this software is granted provided this copyright notice appears
4 // in all copies. This software is provided "as is" without express or implied
5 // warranty, and with no claim as to its suitability for any purpose.
7 // See http://www.boost.org for most recent version including documentation.
9 // forward declarations of type_traits classes
11 #ifndef BOOST_FWD_TYPE_TRAITS_HPP
12 #define BOOST_FWD_TYPE_TRAITS_HPP
17 #ifndef BOOST_CONFIG_HPP
18 #include <boost/config.hpp>
22 // Helper macros for builtin compiler support.
23 // If your compiler has builtin support for any of the following
24 // traits concepts, then redefine the appropriate macros to pick
25 // up on the compiler support:
27 // (these should largely ignore cv-qualifiers)
28 // BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type
29 // BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type
30 // BOOST_IS_UNION(T) should evaluate to true if T is a union type
31 // BOOST_IS_POD(T) should evaluate to true if T is a POD type
32 // BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union
33 // BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect
34 // BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
35 // BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
36 // BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
38 #ifdef BOOST_HAS_SGI_TYPE_TRAITS
39 # define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value
40 # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value
41 # define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value
42 # define BOOST_HAS_TRIVIAL_ASSIGN(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_assignment_operator, ::__true_type>::value
43 # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_destructor, ::__true_type>::value
46 #ifndef BOOST_IS_CLASS
47 # define BOOST_IS_CLASS(T) false
51 # define BOOST_IS_ENUM(T) false
54 #ifndef BOOST_IS_UNION
55 # define BOOST_IS_UNION(T) false
59 # define BOOST_IS_POD(T) false
62 #ifndef BOOST_IS_EMPTY
63 # define BOOST_IS_EMPTY(T) false
66 #ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR
67 # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false
70 #ifndef BOOST_HAS_TRIVIAL_COPY
71 # define BOOST_HAS_TRIVIAL_COPY(T) false
74 #ifndef BOOST_HAS_TRIVIAL_ASSIGN
75 # define BOOST_HAS_TRIVIAL_ASSIGN(T) false
78 #ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR
79 # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false
83 // whenever we have a conversion function with elipses
84 // it needs to be declared __cdecl to suppress compiler
85 // warnings from MS and Borland compilers:
86 #if defined(BOOST_MSVC) || defined(__BORLANDC__)
87 #define BOOST_TT_DECL __cdecl
95 // forward declare all type traits templates here
97 // conversion_traits.hpp:
98 template <class From, class To>
99 struct is_convertible;
100 // alignment_traits.hpp:
103 // arithmetic_traits.hpp:
111 struct is_arithmetic;
113 struct is_fundamental;
123 struct remove_volatile;
133 // composite_traits.hpp:
141 struct is_member_pointer;
143 struct is_member_function_pointer;
149 // object_traits.hpp:
161 struct has_trivial_constructor;
163 struct has_trivial_copy;
165 struct has_trivial_assign;
167 struct has_trivial_destructor;
169 struct has_nothrow_constructor;
171 struct has_nothrow_copy;
173 struct has_nothrow_assign;
176 template <class Base, class Derived>
177 struct is_base_and_derived;
179 // transform_traits.hpp:
181 struct remove_reference;
183 struct add_reference;
185 struct remove_bounds;
187 struct remove_pointer;
192 template <class T, class U>
197 #endif // BOOST_FWD_TYPE_TRAITS_HPP