mirror of
https://git.mirrors.martin98.com/https://github.com/google/googletest.git
synced 2025-06-04 11:25:34 +08:00
Avoid creating std::vector<const T> in UnorderedElementsAreArrayMatcher and others.
std::vector<const T> for trivially relocatable types is not allowed by C++ and is rejected by libc++ starting from 4e112e5c1c
PiperOrigin-RevId: 686487841
Change-Id: I3c90c7c0a6e8e23ffa5ebd1702a3f30ebc4a702f
This commit is contained in:
parent
62df7bdbc1
commit
df1544bcee
@ -1523,7 +1523,7 @@ class SomeOfArrayMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ::std::vector<T> matchers_;
|
const std::vector<std::remove_const_t<T>> matchers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -3805,7 +3805,7 @@ class UnorderedElementsAreArrayMatcher {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
UnorderedMatcherRequire::Flags match_flags_;
|
UnorderedMatcherRequire::Flags match_flags_;
|
||||||
::std::vector<T> matchers_;
|
std::vector<std::remove_const_t<T>> matchers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ElementsAreArray().
|
// Implements ElementsAreArray().
|
||||||
@ -3826,7 +3826,7 @@ class ElementsAreArrayMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ::std::vector<T> matchers_;
|
const std::vector<std::remove_const_t<T>> matchers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second
|
// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second
|
||||||
@ -4793,9 +4793,10 @@ Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
|
|||||||
|
|
||||||
// Supports the Pointwise(m, {a, b, c}) syntax.
|
// Supports the Pointwise(m, {a, b, c}) syntax.
|
||||||
template <typename TupleMatcher, typename T>
|
template <typename TupleMatcher, typename T>
|
||||||
inline internal::PointwiseMatcher<TupleMatcher, std::vector<T>> Pointwise(
|
inline internal::PointwiseMatcher<TupleMatcher,
|
||||||
const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
|
std::vector<std::remove_const_t<T>>>
|
||||||
return Pointwise(tuple_matcher, std::vector<T>(rhs));
|
Pointwise(const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
|
||||||
|
return Pointwise(tuple_matcher, std::vector<std::remove_const_t<T>>(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnorderedPointwise(pair_matcher, rhs) matches an STL-style
|
// UnorderedPointwise(pair_matcher, rhs) matches an STL-style
|
||||||
|
Loading…
x
Reference in New Issue
Block a user