summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2015-11-05 20:35:10 -0600
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 15:30:27 -0600
commit9a54b1a965309773bac3bd3ea915e20151397503 (patch)
tree4fa71b5931467a75c0635e9348c18b7ddf0534b2
parent46af7549e1b53fb49161cc1f84406ef5f334eb05 (diff)
downloadtalos-hostboot-9a54b1a965309773bac3bd3ea915e20151397503.tar.gz
talos-hostboot-9a54b1a965309773bac3bd3ea915e20151397503.zip
Implement std::move, std::forward.
RTC: 124148 Change-Id: Id3d03981472aa7acf5755ca78e4d47914cd9cdd6 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21799 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: Brian Silver <bsilver@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-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