summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/type_traits1
-rw-r--r--src/include/util/impl/type_add.H46
-rw-r--r--src/include/utility25
3 files changed, 71 insertions, 1 deletions
diff --git a/src/include/type_traits b/src/include/type_traits
index 6449ec07d..bd5527197 100644
--- a/src/include/type_traits
+++ b/src/include/type_traits
@@ -24,6 +24,7 @@
/* IBM_PROLOG_END_TAG */
#include <util/impl/integral.H>
#include <util/impl/type_remove.H>
+#include <util/impl/type_add.H>
#include <util/impl/is_same.H>
#include <util/impl/is_integral.H>
#include <util/impl/is_ptr.H>
diff --git a/src/include/util/impl/type_add.H b/src/include/util/impl/type_add.H
new file mode 100644
index 000000000..b0ef4b0fb
--- /dev/null
+++ b/src/include/util/impl/type_add.H
@@ -0,0 +1,46 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/util/impl/type_add.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_ADD_H
+#define __UTIL_IMPL_TYPE_ADD_H
+
+#include <util/impl/type_remove.H>
+
+namespace std
+{
+ template <typename T> struct add_const { typedef const T type; };
+ template <typename T> struct add_volatile { typedef volatile T type; };
+ template <typename T> struct add_cv { typedef const volatile T type; };
+
+ template <typename T> struct add_pointer
+ { typedef typename std::remove_reference<T>::type* type; };
+
+ template <typename T> struct add_lvalue_reference
+ { typedef typename std::remove_reference<T>::type& type; };
+
+ template <typename T> struct add_rvalue_reference
+ { typedef typename std::remove_reference<T>::type&& type; };
+}
+
+#endif
diff --git a/src/include/utility b/src/include/utility
index 685a70885..e680f669e 100644
--- a/src/include/utility
+++ b/src/include/utility
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,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. */
@@ -23,6 +25,7 @@
#ifndef STL_UTILITY
#define STL_UTILITY
+#include <type_traits>
namespace std
{
@@ -131,6 +134,26 @@ namespace std
{
return !(x < y);
}
+
+ template<typename T>
+ constexpr typename std::remove_reference<T>::type&& move(T&& t)
+ {
+ return static_cast<typename std::remove_reference<T>::type&&>(t);
+ }
+
+ template<typename T>
+ constexpr T&& forward(typename std::remove_reference<T>::type& t)
+ {
+ return static_cast<T&&>(t);
+ }
+
+ template<typename T>
+ constexpr T&& forward(typename std::remove_reference<T>::type&& t)
+ {
+ static_assert(!std::is_lvalue_reference<T>::value,
+ "Incorrect substitution of lvalue reference.");
+ return static_cast<T&&>(t);
+ }
};
OpenPOWER on IntegriCloud