摘要:C++支持1,2,3,4个字节的字符集,已有std::string,std::wstring,std::u8string,std::u16string,std::u32string std::string "hello world" char ANSI std::wstring L"hello wo
阅读全文
|
随笔分类 - C++
打牢基础
摘要:C++支持1,2,3,4个字节的字符集,已有std::string,std::wstring,std::u8string,std::u16string,std::u32string std::string "hello world" char ANSI std::wstring L"hello wo
阅读全文
摘要:1.预处理 将.c中的头文件、宏展开 生成的文件是.i文件 gcc -E hello.c -o hello.i 2.编译 将预处理后的.i文件生成.s汇编文件 gcc -S hello.i -o hello.s 3.汇编 将.s文件生成.o目标文件 gcc -c hello.s -o hello.o
阅读全文
摘要:一:基本范例 a)模板的定义是以template关键字开头的 b)类型模板参数T前面用typename来修饰,遇到typename就该知道其后面跟的是一个类型。typename可以被class取代 c)类型模板参数T(代表一个类型),前面的修饰符typename/class都用<>括起来 d)T这个
阅读全文
摘要:1 /* 2 多态:父类虚函数、子类重写虚函数 3 类之间的关系强弱顺序:继承(泛化)> 组合 > 聚合 > 关联 > 依赖 4 关联的两个对象之间一般是平等的,聚合则一般不平等 5 关联关系:表示两个对象之间的一种简单的联系,如朋友之间,关系平等 6 聚合关系:独立存在,如人和书之间 7 组合关系
阅读全文
摘要:#include "iostream" #include "filesystem" #include "fstream" #ifdef WIN32 //Windows #include <direct.h> #include <io.h>#else // Linux #include <sys/io
阅读全文
摘要:一、使用场景 在主线程中创建一个子线程去计数,计数累计100次后认为成功,并告诉主线程;主线程收到计数100次完成的信息后继续往下执行 二、条件变量的成员函数 wait:当前线程调用 wait() 后将被阻塞,直到另一个线程调用 noteify() 唤醒当前线程,使其被阻塞在锁竞争上的线程继续运行。
阅读全文
|