summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2014-11-17 00:55:43 +0000
committerkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2014-11-17 00:55:43 +0000
commitfa037f15f9de10e04f1406d61ce58a7198258ffd (patch)
tree7e8a9c7346b7ada6847b3af094419319ccfc5cad /include
parentcf04de739d74417ebf73c34c8ea86d53bbe1f893 (diff)
downloadgoogletest-fa037f15f9de10e04f1406d61ce58a7198258ffd.tar.gz
Add ByMove() modifier for the Return() action.
git-svn-id: http://googletest.googlecode.com/svn/trunk@695 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'include')
-rw-r--r--include/gtest/internal/gtest-port.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 17220a5..6c2150d 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -206,7 +206,7 @@
//
// C++11 feature wrappers:
//
-// GTEST_MOVE_ - portability wrapper for std::move.
+// testing::internal::move - portability wrapper for std::move.
//
// Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
@@ -905,12 +905,6 @@ using ::std::tuple_size;
# define GTEST_MUST_USE_RESULT_
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-#if GTEST_HAS_STD_MOVE_
-# define GTEST_MOVE_(x) ::std::move(x) // NOLINT
-#else
-# define GTEST_MOVE_(x) x
-#endif
-
// MS C++ compiler emits warning when a conditional expression is compile time
// constant. In some contexts this warning is false positive and needs to be
// suppressed. Use the following two macros in such cases:
@@ -1323,6 +1317,15 @@ inline void FlushInfoLog() { fflush(NULL); }
GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
<< gtest_error
+#if GTEST_HAS_STD_MOVE_
+using std::move;
+#else // GTEST_LANG_CXX11
+template <typename T>
+const T& move(const T& t) {
+ return t;
+}
+#endif // GTEST_HAS_STD_MOVE_
+
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
// Use ImplicitCast_ as a safe version of static_cast for upcasting in
@@ -1344,7 +1347,7 @@ inline void FlushInfoLog() { fflush(NULL); }
// similar functions users may have (e.g., implicit_cast). The internal
// namespace alone is not enough because the function can be found by ADL.
template<typename To>
-inline To ImplicitCast_(To x) { return x; }
+inline To ImplicitCast_(To x) { return move(x); }
// When you upcast (that is, cast a pointer from type Foo to type
// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts