diff options
author | Krystian Kuzniarek <krystian.kuzniarek@gmail.com> | 2019-08-13 21:59:59 (GMT) |
---|---|---|
committer | Krystian Kuzniarek <krystian.kuzniarek@gmail.com> | 2019-08-13 22:34:04 (GMT) |
commit | 364839ab142e5d6e4efc89953e0911267d7c5502 (patch) | |
tree | 67c1a6ebc130deb0797747e64b26b8a6083b2808 /googlemock/include | |
parent | 90a443f9c2437ca8a682a1ac625eba64e1d74a8a (diff) | |
download | googletest-364839ab142e5d6e4efc89953e0911267d7c5502.zip googletest-364839ab142e5d6e4efc89953e0911267d7c5502.tar.gz googletest-364839ab142e5d6e4efc89953e0911267d7c5502.tar.bz2 |
remove a custom implementation of std::remove_constrefs/pull/2393/head
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 37 | ||||
-rw-r--r-- | googlemock/include/gmock/internal/gmock-internal-utils.h | 10 |
2 files changed, 24 insertions, 23 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 7075082..7185390 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1610,8 +1610,9 @@ class PointeeMatcher { template <typename Pointer> class Impl : public MatcherInterface<Pointer> { public: - typedef typename PointeeOf<GTEST_REMOVE_CONST_( // NOLINT - GTEST_REMOVE_REFERENCE_(Pointer))>::type Pointee; + typedef + typename PointeeOf<typename std::remove_const<GTEST_REMOVE_REFERENCE_( + Pointer)>::type>::type Pointee; explicit Impl(const InnerMatcher& matcher) : matcher_(MatcherCast<const Pointee&>(matcher)) {} @@ -1749,8 +1750,8 @@ class FieldMatcher { // FIXME: The dispatch on std::is_pointer was introduced as a workaround for // a compiler bug, and can now be removed. return MatchAndExplainImpl( - typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value, - listener); + typename std::is_pointer<typename std::remove_const<T>::type>::type(), + value, listener); } private: @@ -1816,8 +1817,8 @@ class PropertyMatcher { template <typename T> bool MatchAndExplain(const T&value, MatchResultListener* listener) const { return MatchAndExplainImpl( - typename std::is_pointer<GTEST_REMOVE_CONST_(T)>::type(), value, - listener); + typename std::is_pointer<typename std::remove_const<T>::type>::type(), + value, listener); } private: @@ -2093,9 +2094,8 @@ class ContainerEqMatcher { template <typename LhsContainer> bool MatchAndExplain(const LhsContainer& lhs, MatchResultListener* listener) const { - // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug - // that causes LhsContainer to be a const type sometimes. - typedef internal::StlContainerView<GTEST_REMOVE_CONST_(LhsContainer)> + typedef internal::StlContainerView< + typename std::remove_const<LhsContainer>::type> LhsView; typedef typename LhsView::type LhsStlContainer; StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); @@ -4034,12 +4034,12 @@ BeginEndDistanceIs(const DistanceMatcher& distance_matcher) { // values that are included in one container but not the other. (Duplicate // values and order differences are not explained.) template <typename Container> -inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT - GTEST_REMOVE_CONST_(Container)> > - ContainerEq(const Container& rhs) { +inline PolymorphicMatcher<internal::ContainerEqMatcher< + typename std::remove_const<Container>::type>> +ContainerEq(const Container& rhs) { // This following line is for working around a bug in MSVC 8.0, // which causes Container to be a const type sometimes. - typedef GTEST_REMOVE_CONST_(Container) RawContainer; + typedef typename std::remove_const<Container>::type RawContainer; return MakePolymorphicMatcher( internal::ContainerEqMatcher<RawContainer>(rhs)); } @@ -4072,12 +4072,12 @@ WhenSorted(const ContainerMatcher& container_matcher) { // LHS container and the RHS container respectively. template <typename TupleMatcher, typename Container> inline internal::PointwiseMatcher<TupleMatcher, - GTEST_REMOVE_CONST_(Container)> + typename std::remove_const<Container>::type> Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { // This following line is for working around a bug in MSVC 8.0, // which causes Container to be a const type sometimes (e.g. when // rhs is a const int[]).. - typedef GTEST_REMOVE_CONST_(Container) RawContainer; + typedef typename std::remove_const<Container>::type RawContainer; return internal::PointwiseMatcher<TupleMatcher, RawContainer>( tuple_matcher, rhs); } @@ -4105,14 +4105,15 @@ inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise( template <typename Tuple2Matcher, typename RhsContainer> inline internal::UnorderedElementsAreArrayMatcher< typename internal::BoundSecondMatcher< - Tuple2Matcher, typename internal::StlContainerView<GTEST_REMOVE_CONST_( - RhsContainer)>::type::value_type> > + Tuple2Matcher, + typename internal::StlContainerView< + typename std::remove_const<RhsContainer>::type>::type::value_type>> UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, const RhsContainer& rhs_container) { // This following line is for working around a bug in MSVC 8.0, // which causes RhsContainer to be a const type sometimes (e.g. when // rhs_container is a const int[]). - typedef GTEST_REMOVE_CONST_(RhsContainer) RawRhsContainer; + typedef typename std::remove_const<RhsContainer>::type RawRhsContainer; // RhsView allows the same code to handle RhsContainer being a // STL-style container and it being a native C-style array. diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index ee00479..4d75483 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -429,8 +429,8 @@ class StlContainerView { static const_reference ConstReference(const RawContainer& container) { // Ensures that RawContainer is not a const type. - testing::StaticAssertTypeEq<RawContainer, - GTEST_REMOVE_CONST_(RawContainer)>(); + testing::StaticAssertTypeEq< + RawContainer, typename std::remove_const<RawContainer>::type>(); return container; } static type Copy(const RawContainer& container) { return container; } @@ -440,7 +440,7 @@ class StlContainerView { template <typename Element, size_t N> class StlContainerView<Element[N]> { public: - typedef GTEST_REMOVE_CONST_(Element) RawElement; + typedef typename std::remove_const<Element>::type RawElement; typedef internal::NativeArray<RawElement> type; // NativeArray<T> can represent a native array either by value or by // reference (selected by a constructor argument), so 'const type' @@ -464,8 +464,8 @@ class StlContainerView<Element[N]> { template <typename ElementPointer, typename Size> class StlContainerView< ::std::tuple<ElementPointer, Size> > { public: - typedef GTEST_REMOVE_CONST_( - typename internal::PointeeOf<ElementPointer>::type) RawElement; + typedef typename std::remove_const< + typename internal::PointeeOf<ElementPointer>::type>::type RawElement; typedef internal::NativeArray<RawElement> type; typedef const type const_reference; |