diff options
author | Abseil Team <absl-team@google.com> | 2020-12-07 21:17:26 (GMT) |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2020-12-07 23:04:12 (GMT) |
commit | a02a591605dfef9addde49634bf010dbe8f95c50 (patch) | |
tree | 6258f1a86109731e61e328b5eac6cdce89146f85 /googlemock/include/gmock/internal | |
parent | 7bf5057a04eebb12cb731bfd6b3a19c510dc5087 (diff) | |
download | googletest-a02a591605dfef9addde49634bf010dbe8f95c50.zip googletest-a02a591605dfef9addde49634bf010dbe8f95c50.tar.gz googletest-a02a591605dfef9addde49634bf010dbe8f95c50.tar.bz2 |
Googletest export
Add a `Pointer` matcher as an analog to `Pointee`.
Similar to `Pointee`, `Pointer` works with either raw or smart pointers and
allows creating a matcher like Pointer(Eq(foo)) for smart pointers.
PiperOrigin-RevId: 346164768
Diffstat (limited to 'googlemock/include/gmock/internal')
-rw-r--r-- | googlemock/include/gmock/internal/gmock-internal-utils.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 5580dcb..200c30e 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -71,20 +71,6 @@ GTEST_API_ std::string JoinAsTuple(const Strings& fields); // "foo_bar_123" are converted to "foo bar 123". GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name); -// PointeeOf<Pointer>::type is the type of a value pointed to by a -// Pointer, which can be either a smart pointer or a raw pointer. The -// following default implementation is for the case where Pointer is a -// smart pointer. -template <typename Pointer> -struct PointeeOf { - // Smart pointer classes define type element_type as the type of - // their pointees. - typedef typename Pointer::element_type type; -}; -// This specialization is for the raw pointer case. -template <typename T> -struct PointeeOf<T*> { typedef T type; }; // NOLINT - // GetRawPointer(p) returns the raw pointer underlying p when p is a // smart pointer, or returns p itself when p is already a raw pointer. // The following default implementation is for the smart pointer case. @@ -378,7 +364,8 @@ template <typename ElementPointer, typename Size> class StlContainerView< ::std::tuple<ElementPointer, Size> > { public: typedef typename std::remove_const< - typename internal::PointeeOf<ElementPointer>::type>::type RawElement; + typename std::pointer_traits<ElementPointer>::element_type>::type + RawElement; typedef internal::NativeArray<RawElement> type; typedef const type const_reference; |