首页 > TAG信息列表 > Mstring

C++学习笔记------Mstring类的实现

2.2 Mstring类的实现 Mstring类基本结构: push_back(), pop_back() is_full(), is_empty() 扩容revert() 输出运算符重载、等号赋值运算符重载、[]运算符重载、比较运算符重载、加法(拼接)运算符重载等 class Mstring { private: char* _str; int _len;//容量 int _val_len;/

4.自己模拟实现一个string

main.cpp #include<iostream> #include<string> using namespace std; int main() { string s1("aaa"); string s2("bbb"); string s3; s3 = s1; s3 = "ccc"; s3 = s1 + s2; s3 = s1 + "ddd"; s3 = "ddd&q

运算符重载-mstring迭代器

实现代码: #pragma once #ifndef MITERATOR_h #define MITERATOR_h //#include"mstring.h" class Mstring; class Miterator { private: Mstring* _p_mstr; int _sit; public: Miterator(Mstring* p_mstr, const int sit) { _p_mstr = p_mstr

运算符重载

一.写时拷贝 在发生修改的时候,才会将父进程的内容复制给子进程,没发生修改的不复制, 二.mstring写时拷贝   #pragma once #ifndef MSTRING_H #define MSTRING_H #include<iostream> using namespace std; #include<mutex> class Mstring { private: int _len; char* _