From c5d957a8fa6dda6752057f2a7e02c1ac53e30a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Sat, 3 Jan 2015 11:59:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4=E4=B8=80=E5=A4=84=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E9=99=90=E9=80=92=E5=BD=92=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Vector.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TinySTL/Vector.h b/TinySTL/Vector.h index 35d9366..0bdf510 100644 --- a/TinySTL/Vector.h +++ b/TinySTL/Vector.h @@ -49,8 +49,8 @@ namespace TinySTL{ } //比较操作相关 - bool operator == (const vector& v); - bool operator != (const vector& v); + bool operator == (const vector& v)const; + bool operator != (const vector& v)const; //迭代器相关 iterator begin(){ return (start_); } @@ -341,7 +341,7 @@ namespace TinySTL{ } //***********逻辑比较操作相关******************* template - bool vector::operator == (const vector& v){ + bool vector::operator == (const vector& v)const{ if (size() != v.size()){ return false; } @@ -356,12 +356,13 @@ namespace TinySTL{ } } template - bool vector::operator != (const vector& v){ + bool vector::operator != (const vector& v)const{ return !(*this == v); } template bool operator == (const vector& v1, const vector& v2){ - return v1 == v2; + //return v1 == v2; + return v1.operator==(v2); } template bool operator != (const vector& v1, const vector& v2){