- [][]:不在其内
楔子
std::string str = "hello ";
str += "world!";
std::cout << str << "\n";
因为运算符重载的缘故,其实质是:
std::string str = "hello ";
str.operator+=("world!");
// operator+=:作为string类的成员运算符重载
operator<<(operator<<(std::cout, str), "\n");
// 全局的或友元的operator<<重载