diff options
Diffstat (limited to 'src/include/utility')
-rw-r--r-- | src/include/utility | 25 |
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); + } }; |