Commit 9bf34ace by Xiaoyi Zhang

Merge pull request #2400 from kuzkry:custom-type-traits-enable_if

PiperOrigin-RevId: 264693952
parents fb49e6c1 11471da7
...@@ -300,7 +300,7 @@ class MatcherBase { ...@@ -300,7 +300,7 @@ class MatcherBase {
template <typename U> template <typename U>
explicit MatcherBase( explicit MatcherBase(
const MatcherInterface<U>* impl, const MatcherInterface<U>* impl,
typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* = typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
nullptr) nullptr)
: impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {} : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
...@@ -336,7 +336,7 @@ class Matcher : public internal::MatcherBase<T> { ...@@ -336,7 +336,7 @@ class Matcher : public internal::MatcherBase<T> {
template <typename U> template <typename U>
explicit Matcher( explicit Matcher(
const MatcherInterface<U>* impl, const MatcherInterface<U>* impl,
typename internal::EnableIf<!std::is_same<U, const U&>::value>::type* = typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
nullptr) nullptr)
: internal::MatcherBase<T>(impl) {} : internal::MatcherBase<T>(impl) {}
......
...@@ -292,7 +292,7 @@ class GTEST_API_ AssertionResult { ...@@ -292,7 +292,7 @@ class GTEST_API_ AssertionResult {
template <typename T> template <typename T>
explicit AssertionResult( explicit AssertionResult(
const T& success, const T& success,
typename internal::EnableIf< typename std::enable_if<
!std::is_convertible<T, AssertionResult>::value>::type* !std::is_convertible<T, AssertionResult>::value>::type*
/*enabler*/ /*enabler*/
= nullptr) = nullptr)
......
...@@ -970,13 +970,6 @@ struct IsRecursiveContainerImpl<C, true> { ...@@ -970,13 +970,6 @@ struct IsRecursiveContainerImpl<C, true> {
template <typename C> template <typename C>
struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {}; struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {};
// EnableIf<condition>::type is void when 'Cond' is true, and
// undefined when 'Cond' is false. To use SFINAE to make a function
// overload only apply when a particular expression is true, add
// "typename EnableIf<expression>::type* = 0" as the last parameter.
template<bool> struct EnableIf;
template<> struct EnableIf<true> { typedef void type; }; // NOLINT
// Utilities for native arrays. // Utilities for native arrays.
// ArrayEq() compares two k-dimensional native arrays using the // ArrayEq() compares two k-dimensional native arrays using the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment