|
Sierra Toolkit
Version of the Day
|
00001 /* 00002 Copyright (C) 2005,2009-2010 Electronic Arts, Inc. All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions 00006 are met: 00007 00008 1. Redistributions of source code must retain the above copyright 00009 notice, this list of conditions and the following disclaimer. 00010 2. Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in the 00012 documentation and/or other materials provided with the distribution. 00013 3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of 00014 its contributors may be used to endorse or promote products derived 00015 from this software without specific prior written permission. 00016 00017 THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY 00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00019 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00020 DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY 00021 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00024 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00026 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00030 // EASTL/internal/type_fundamental.h 00031 // 00032 // Written and maintained by Paul Pedriana - 2005. 00034 00035 00036 #ifndef EASTL_INTERNAL_TYPE_FUNDAMENTAL_H 00037 #define EASTL_INTERNAL_TYPE_FUNDAMENTAL_H 00038 00039 00040 namespace eastl 00041 { 00042 00043 // The following properties or relations are defined here. If the given 00044 // item is missing then it simply hasn't been implemented, at least not yet. 00045 00046 00048 // is_void 00049 // 00050 // is_void<T>::value == true if and only if T is one of the following types: 00051 // [const][volatile] void 00052 // 00054 template <typename T> struct is_void : public false_type{}; 00055 00056 template <> struct is_void<void> : public true_type{}; 00057 template <> struct is_void<void const> : public true_type{}; 00058 template <> struct is_void<void volatile> : public true_type{}; 00059 template <> struct is_void<void const volatile> : public true_type{}; 00060 00061 00063 // is_integral 00064 // 00065 // is_integral<T>::value == true if and only if T is one of the following types: 00066 // [const] [volatile] bool 00067 // [const] [volatile] char 00068 // [const] [volatile] signed char 00069 // [const] [volatile] unsigned char 00070 // [const] [volatile] wchar_t 00071 // [const] [volatile] short 00072 // [const] [volatile] int 00073 // [const] [volatile] long 00074 // [const] [volatile] long long 00075 // [const] [volatile] unsigned short 00076 // [const] [volatile] unsigned int 00077 // [const] [volatile] unsigned long 00078 // [const] [volatile] unsigned long long 00079 // 00081 template <typename T> struct is_integral : public false_type{}; 00082 00083 // To do: Need to define volatile and const volatile versions of these. 00084 template <> struct is_integral<unsigned char> : public true_type{}; 00085 template <> struct is_integral<const unsigned char> : public true_type{}; 00086 template <> struct is_integral<unsigned short> : public true_type{}; 00087 template <> struct is_integral<const unsigned short> : public true_type{}; 00088 template <> struct is_integral<unsigned int> : public true_type{}; 00089 template <> struct is_integral<const unsigned int> : public true_type{}; 00090 template <> struct is_integral<unsigned long> : public true_type{}; 00091 template <> struct is_integral<const unsigned long> : public true_type{}; 00092 template <> struct is_integral<unsigned long long> : public true_type{}; 00093 template <> struct is_integral<const unsigned long long> : public true_type{}; 00094 00095 template <> struct is_integral<signed char> : public true_type{}; 00096 template <> struct is_integral<const signed char> : public true_type{}; 00097 template <> struct is_integral<signed short> : public true_type{}; 00098 template <> struct is_integral<const signed short> : public true_type{}; 00099 template <> struct is_integral<signed int> : public true_type{}; 00100 template <> struct is_integral<const signed int> : public true_type{}; 00101 template <> struct is_integral<signed long> : public true_type{}; 00102 template <> struct is_integral<const signed long> : public true_type{}; 00103 template <> struct is_integral<signed long long> : public true_type{}; 00104 template <> struct is_integral<const signed long long> : public true_type{}; 00105 00106 template <> struct is_integral<bool> : public true_type{}; 00107 template <> struct is_integral<const bool> : public true_type{}; 00108 template <> struct is_integral<char> : public true_type{}; 00109 template <> struct is_integral<const char> : public true_type{}; 00110 #ifndef EA_WCHAR_T_NON_NATIVE // If wchar_t is a native type instead of simply a define to an existing type... 00111 template <> struct is_integral<wchar_t> : public true_type{}; 00112 template <> struct is_integral<const wchar_t> : public true_type{}; 00113 #endif 00114 00116 // is_floating_point 00117 // 00118 // is_floating_point<T>::value == true if and only if T is one of the following types: 00119 // [const] [volatile] float 00120 // [const] [volatile] double 00121 // [const] [volatile] long double 00122 // 00124 template <typename T> struct is_floating_point : public false_type{}; 00125 00126 // To do: Need to define volatile and const volatile versions of these. 00127 template <> struct is_floating_point<float> : public true_type{}; 00128 template <> struct is_floating_point<const float> : public true_type{}; 00129 template <> struct is_floating_point<double> : public true_type{}; 00130 template <> struct is_floating_point<const double> : public true_type{}; 00131 template <> struct is_floating_point<long double> : public true_type{}; 00132 template <> struct is_floating_point<const long double> : public true_type{}; 00133 00134 00135 00137 // is_arithmetic 00138 // 00139 // is_arithmetic<T>::value == true if and only if: 00140 // is_floating_point<T>::value == true, or 00141 // is_integral<T>::value == true 00142 // 00144 template <typename T> 00145 struct is_arithmetic : public integral_constant<bool, 00146 is_integral<T>::value || is_floating_point<T>::value 00147 >{}; 00148 00149 00151 // is_fundamental 00152 // 00153 // is_fundamental<T>::value == true if and only if: 00154 // is_floating_point<T>::value == true, or 00155 // is_integral<T>::value == true, or 00156 // is_void<T>::value == true 00158 template <typename T> 00159 struct is_fundamental : public integral_constant<bool, 00160 is_void<T>::value || is_integral<T>::value || is_floating_point<T>::value 00161 >{}; 00162 00163 } // namespace eastl 00164 00165 00166 #endif // Header include guard