diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 17:38:08 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 17:38:08 +0000 |
commit | 4bd79e4f25a86f3a2a99f6af06cc43cdacc55853 (patch) | |
tree | 7500e3e892696d384d320f8c6c95320d1e3c58b7 /include/gmock/internal/gmock-internal-utils.h | |
parent | f5e1ce5b9237edbc2e524ae9ebcb2452dc842937 (diff) | |
download | googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.tar.gz googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.tar.bz2 googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.zip |
Simplifies the definition of NativeArray. Works around a VC bug in StrictMock & NiceMock.
Diffstat (limited to 'include/gmock/internal/gmock-internal-utils.h')
-rw-r--r-- | include/gmock/internal/gmock-internal-utils.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/include/gmock/internal/gmock-internal-utils.h b/include/gmock/internal/gmock-internal-utils.h index ee6aa1e2..39e70b3f 100644 --- a/include/gmock/internal/gmock-internal-utils.h +++ b/include/gmock/internal/gmock-internal-utils.h @@ -581,21 +581,9 @@ class NativeArray { typedef Element value_type; typedef const Element* const_iterator; - // Constructs from a native array passed by reference. - template <size_t N> - NativeArray(const Element (&array)[N], RelationToSource relation) { - Init(array, N, relation); - } - - // Constructs from a native array passed by a pointer and a size. - // For generality we don't artificially restrict the types of the - // pointer and the size. - template <typename Pointer, typename Size> - NativeArray(const ::std::tr1::tuple<Pointer, Size>& array, - RelationToSource relation) { - Init(internal::GetRawPointer(::std::tr1::get<0>(array)), - ::std::tr1::get<1>(array), - relation); + // Constructs from a native array. + NativeArray(const Element* array, size_t count, RelationToSource relation) { + Init(array, count, relation); } // Copy constructor. @@ -691,10 +679,10 @@ class StlContainerView<Element[N]> { static const_reference ConstReference(const Element (&array)[N]) { // Ensures that Element is not a const type. testing::StaticAssertTypeEq<Element, RawElement>(); - return type(array, kReference); + return type(array, N, kReference); } static type Copy(const Element (&array)[N]) { - return type(array, kCopy); + return type(array, N, kCopy); } }; @@ -710,10 +698,12 @@ class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > { static const_reference ConstReference( const ::std::tr1::tuple<ElementPointer, Size>& array) { - return type(array, kReference); + using ::std::tr1::get; + return type(get<0>(array), get<1>(array), kReference); } static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) { - return type(array, kCopy); + using ::std::tr1::get; + return type(get<0>(array), get<1>(array), kCopy); } }; |