googlemock: Support C++11 language with pre-C++11 library

This guards use of <type_traits> and its features with
GTEST_HAS_STD_TYPE_TRAITS_, and std::function with
GTEST_HAS_STD_FUNCTION_.
This commit is contained in:
Mark Mentovai
2015-10-12 17:57:51 -04:00
parent 7f4448f40b
commit a0435dc687
4 changed files with 12 additions and 11 deletions

View File

@@ -46,7 +46,7 @@
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h"
#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h.
#include <type_traits>
#endif
@@ -96,7 +96,7 @@ struct BuiltInDefaultValueGetter<T, false> {
template <typename T>
class BuiltInDefaultValue {
public:
#if GTEST_LANG_CXX11
#if GTEST_HAS_STD_TYPE_TRAITS_
// This function returns true iff type T has a built-in default value.
static bool Exists() {
return ::std::is_default_constructible<T>::value;
@@ -107,7 +107,7 @@ class BuiltInDefaultValue {
T, ::std::is_default_constructible<T>::value>::Get();
}
#else // GTEST_LANG_CXX11
#else // GTEST_HAS_STD_TYPE_TRAITS_
// This function returns true iff type T has a built-in default value.
static bool Exists() {
return false;
@@ -117,7 +117,7 @@ class BuiltInDefaultValue {
return BuiltInDefaultValueGetter<T, false>::Get();
}
#endif // GTEST_LANG_CXX11
#endif // GTEST_HAS_STD_TYPE_TRAITS_
};
// This partial specialization says that we use the same built-in