summaryrefslogtreecommitdiffstats
path: root/src/include/util
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2015-11-04 08:09:24 -0600
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 15:30:27 -0600
commitedb283c78cad6294def01f3a8c77cd79db3f81db (patch)
tree6fcdeb2af6c59960dc54dc30ab31b28b8f87e7c3 /src/include/util
parent2b399b960c2299e851d2ba208f486efed24074c8 (diff)
downloadtalos-hostboot-edb283c78cad6294def01f3a8c77cd79db3f81db.tar.gz
talos-hostboot-edb283c78cad6294def01f3a8c77cd79db3f81db.zip
Implement std::is_integral.
RTC: 124148 Change-Id: I01b8f3c1fb27068e0384045c65c271baefd25622 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21796 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: Brian Silver <bsilver@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/util')
-rw-r--r--src/include/util/impl/is_integral.H52
-rw-r--r--src/include/util/impl/type_remove.H57
2 files changed, 109 insertions, 0 deletions
diff --git a/src/include/util/impl/is_integral.H b/src/include/util/impl/is_integral.H
new file mode 100644
index 000000000..0305ee9d5
--- /dev/null
+++ b/src/include/util/impl/is_integral.H
@@ -0,0 +1,52 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/util/impl/_is_integral.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __UTIL_IMPL_IS_INTEGRAL_H
+#define __UTIL_IMPL_IS_INTEGRAL_H
+
+#include <util/impl/integral.H>
+#include <util/impl/type_remove.H>
+
+namespace std
+{
+ template <typename T> struct _is_integral : std::false_type {};
+ template <> struct _is_integral<bool> : std::true_type {};
+ template <> struct _is_integral<char> : std::true_type {};
+ template <> struct _is_integral<short> : std::true_type {};
+ template <> struct _is_integral<int> : std::true_type {};
+ template <> struct _is_integral<long> : std::true_type {};
+ template <> struct _is_integral<long long> : std::true_type {};
+ template <> struct _is_integral<unsigned char> : std::true_type {};
+ template <> struct _is_integral<unsigned short> : std::true_type {};
+ template <> struct _is_integral<unsigned int> : std::true_type {};
+ template <> struct _is_integral<unsigned long> : std::true_type {};
+ template <> struct _is_integral<unsigned long long> : std::true_type {};
+
+ template <typename T> struct is_integral :
+ _is_integral<
+ typename std::remove_cv<
+ typename std::remove_reference<T>::type>::type> {};
+
+}
+#endif
diff --git a/src/include/util/impl/type_remove.H b/src/include/util/impl/type_remove.H
new file mode 100644
index 000000000..4b33f2e36
--- /dev/null
+++ b/src/include/util/impl/type_remove.H
@@ -0,0 +1,57 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/util/impl/type_remove.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __UTIL_IMPL_TYPE_REMOVE_H
+#define __UTIL_IMPL_TYPE_REMOVE_H
+
+namespace std
+{
+ template <typename T> struct remove_const { typedef T type; };
+ template <typename T> struct remove_const<const T> { typedef T type; };
+
+ template <typename T> struct remove_volatile { typedef T type; };
+ template <typename T> struct remove_volatile<volatile T>
+ { typedef T type; };
+
+ template <typename T> struct remove_cv
+ {
+ typedef typename remove_const<typename remove_volatile<T>::type>::type
+ type;
+ };
+
+ template <typename T> struct remove_reference { typedef T type; };
+ template <typename T> struct remove_reference<T&> { typedef T type; };
+ template <typename T> struct remove_reference<T&&> { typedef T type; };
+
+ template <typename T> struct remove_pointer { typedef T type; };
+ template <typename T> struct remove_pointer<T*> { typedef T type; };
+ template <typename T> struct remove_pointer<T* const> { typedef T type; };
+ template <typename T> struct remove_pointer<T* volatile>
+ { typedef T type; };
+ template <typename T> struct remove_pointer<T* const volatile>
+ { typedef T type; };
+
+}
+
+#endif
OpenPOWER on IntegriCloud