summaryrefslogtreecommitdiffstats
path: root/src/include/utility
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 /src/include/utility
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>
Diffstat (limited to 'src/include/utility')
-rw-r--r--src/include/utility25
1 files changed, 24 insertions, 1 deletions
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