From 9fd3917aaf775651fb787c215985c8e20c8986c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Fri, 10 Oct 2014 19:11:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E9=83=A8friend?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=8E=9F=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/String.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/TinySTL/String.h b/TinySTL/String.h index da42d1e..a3dd121 100644 --- a/TinySTL/String.h +++ b/TinySTL/String.h @@ -212,6 +212,33 @@ namespace TinySTL{ int compare_aux(size_t pos, size_t len, const_iterator cit, size_t subpos, size_t sublen)const; public: friend std::ostream& operator <<(std::ostream& os, const string&str); + friend std::istream& operator>> (std::istream& is, string& str); + friend string operator+ (const string& lhs, const string& rhs); + friend string operator+ (const string& lhs, const char* rhs); + friend string operator+ (const char* lhs, const string& rhs); + friend string operator+ (const string& lhs, char rhs); + friend string operator+ (char lhs, const string& rhs); + friend bool operator== (const string& lhs, const string& rhs); + friend bool operator== (const char* lhs, const string& rhs); + friend bool operator== (const string& lhs, const char* rhs); + friend bool operator!= (const string& lhs, const string& rhs); + friend bool operator!= (const char* lhs, const string& rhs); + friend bool operator!= (const string& lhs, const char* rhs); + friend bool operator< (const string& lhs, const string& rhs); + friend bool operator< (const char* lhs, const string& rhs); + friend bool operator< (const string& lhs, const char* rhs); + friend bool operator<= (const string& lhs, const string& rhs); + friend bool operator<= (const char* lhs, const string& rhs); + friend bool operator<= (const string& lhs, const char* rhs); + friend bool operator> (const string& lhs, const string& rhs); + friend bool operator> (const char* lhs, const string& rhs); + friend bool operator> (const string& lhs, const char* rhs); + friend bool operator>= (const string& lhs, const string& rhs); + friend bool operator>= (const char* lhs, const string& rhs); + friend bool operator>= (const string& lhs, const char* rhs); + friend void swap(string& x, string& y); + friend std::istream& getline(std::istream& is, string& str, char delim); + friend std::istream& getline(std::istream& is, string& str); };// end of string const size_t string::npos; @@ -573,5 +600,8 @@ namespace TinySTL{ } return os; } + void swap(string& x, string& y){ + x.swap(y); + } } #endif \ No newline at end of file