diff options
author | kosak <kosak@google.com> | 2014-07-28 20:01:28 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2014-07-28 20:01:28 +0000 |
commit | 06678924fa3a48708f2c90e7226dfda54badc808 (patch) | |
tree | 0f4028e743d846cd3a3484bfbdf914dc193002b5 /include | |
parent | a9e02a9178d29446b77564dd59e995ec4acfeb11 (diff) | |
download | googletest-06678924fa3a48708f2c90e7226dfda54badc808.tar.gz googletest-06678924fa3a48708f2c90e7226dfda54badc808.tar.bz2 googletest-06678924fa3a48708f2c90e7226dfda54badc808.zip |
Allows {Unordered,}ElementsAreArray() to accept any STL-style container as the parameter.
Diffstat (limited to 'include')
-rw-r--r-- | include/gmock/gmock-matchers.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index bd90d81f..e23dafb9 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -3444,7 +3444,7 @@ GTEST_API_ string FormatMatcherDescription(bool negation, // ElementsAreArray(first, last) // ElementsAreArray(pointer, count) // ElementsAreArray(array) -// ElementsAreArray(vector) +// ElementsAreArray(container) // ElementsAreArray({ e1, e2, ..., en }) // // The ElementsAreArray() functions are like ElementsAre(...), except @@ -3476,10 +3476,10 @@ inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( return ElementsAreArray(array, N); } -template <typename T, typename A> -inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( - const ::std::vector<T, A>& vec) { - return ElementsAreArray(vec.begin(), vec.end()); +template <typename Container> +inline internal::ElementsAreArrayMatcher<typename Container::value_type> +ElementsAreArray(const Container& container) { + return ElementsAreArray(container.begin(), container.end()); } #if GTEST_HAS_STD_INITIALIZER_LIST_ @@ -3493,7 +3493,7 @@ ElementsAreArray(::std::initializer_list<T> xs) { // UnorderedElementsAreArray(first, last) // UnorderedElementsAreArray(pointer, count) // UnorderedElementsAreArray(array) -// UnorderedElementsAreArray(vector) +// UnorderedElementsAreArray(container) // UnorderedElementsAreArray({ e1, e2, ..., en }) // // The UnorderedElementsAreArray() functions are like @@ -3518,10 +3518,11 @@ UnorderedElementsAreArray(const T (&array)[N]) { return UnorderedElementsAreArray(array, N); } -template <typename T, typename A> -inline internal::UnorderedElementsAreArrayMatcher<T> -UnorderedElementsAreArray(const ::std::vector<T, A>& vec) { - return UnorderedElementsAreArray(vec.begin(), vec.end()); +template <typename Container> +inline internal::UnorderedElementsAreArrayMatcher< + typename Container::value_type> +UnorderedElementsAreArray(const Container& container) { + return UnorderedElementsAreArray(container.begin(), container.end()); } #if GTEST_HAS_STD_INITIALIZER_LIST_ |