From 4bd79e4f25a86f3a2a99f6af06cc43cdacc55853 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Wed, 16 Sep 2009 17:38:08 +0000 Subject: Simplifies the definition of NativeArray. Works around a VC bug in StrictMock & NiceMock. --- include/gmock/internal/gmock-internal-utils.h | 28 +++++++++------------------ 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'include/gmock/internal/gmock-internal-utils.h') 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 - 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 - NativeArray(const ::std::tr1::tuple& 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 { static const_reference ConstReference(const Element (&array)[N]) { // Ensures that Element is not a const type. testing::StaticAssertTypeEq(); - 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 > { static const_reference ConstReference( const ::std::tr1::tuple& 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& array) { - return type(array, kCopy); + using ::std::tr1::get; + return type(get<0>(array), get<1>(array), kCopy); } }; -- cgit v1.2.3