随笔分类 -  软件技术

上一页 1 2 3 4 5 6 7 ··· 24 下一页
编程语言,计算机软件相关
摘要:除了顺序容器外,标准库还定义了三个顺序容器适配器:stack、queue和priority_queue。适配器(adaptor)是标准库中的一个通用概念。容器、迭代器和函数都有适配器。本质上,一个适配器是一种机制,能使某种事物的行为看起来像另外一种事物一样。一个容器适配器接受一种已有的容器类型,使其 阅读全文
posted @ 2024-10-03 14:21 double64 阅读(19) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P328 阅读全文
posted @ 2024-10-03 14:14 double64 阅读(4) 评论(0) 推荐(0) 编辑
摘要:string 构造: ▲ 《C++ Primer》 P321 string 裁剪: ▲ 《C++ Primer》 P322 修改 string 的操作: ▲ 《C++ Primer》 P323 string 的搜索操作: ▲ 《C++ Primer》 P325 string 的 compare 函数 阅读全文
posted @ 2024-10-03 14:12 double64 阅读(4) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P314 ▲ 《C++ Primer》 P318 阅读全文
posted @ 2024-10-03 13:55 double64 阅读(2) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P313 阅读全文
posted @ 2024-10-03 13:49 double64 阅读(9) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P311 阅读全文
posted @ 2024-10-03 13:48 double64 阅读(3) 评论(0) 推荐(0) 编辑
摘要:《C++ Primer》 P310 阅读全文
posted @ 2024-10-03 13:40 double64 阅读(2) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P305 阅读全文
posted @ 2024-10-03 13:37 double64 阅读(6) 评论(0) 推荐(0) 编辑
摘要:在4.11.3节(第145页)中我们说过,const_cast 在重载函数的情景中最有用。举个例子,回忆6.3.2节(第201页)的shorterstring 函数: //比较两个string对象的长度,返回较短的那个引用 const string &shorterString(const stri 阅读全文
posted @ 2024-09-29 15:51 double64 阅读(4) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P302 assign list<string> names; vector<const char *> old_c_str{ "娃哈哈", "孟菲斯", "Hello Wold!" }; names.assign(old_c_str.cbegin(), old_c_s 阅读全文
posted @ 2024-09-27 22:09 double64 阅读(4) 评论(0) 推荐(0) 编辑
摘要:▲ 《C++ Primer》 P299 阅读全文
posted @ 2024-09-26 08:07 double64 阅读(5) 评论(0) 推荐(0) 编辑
摘要:▲ 容器操作 《C++ Primer》 P295 阅读全文
posted @ 2024-09-26 07:59 double64 阅读(4) 评论(0) 推荐(0) 编辑
摘要:▲ 顺序容器类型 《C++ Primer》 P294 阅读全文
posted @ 2024-09-26 07:37 double64 阅读(2) 评论(0) 推荐(0) 编辑
摘要:IO 库: istream(输入流)类型,提供输入操作。 ostream(输出流)类型,提供输出操作。 cin,一个istream对象,从标准输入读取数据。 cout,一个ostream对象,向标准输出写入数据。 cerr,一个ostream对象,通常用于输出程序错误消息,写入到标准错误。 >>运算 阅读全文
posted @ 2024-09-24 23:02 double64 阅读(9) 评论(0) 推荐(0) 编辑
摘要:这样转化是没有问题的。 int a{ 100 }; const void *p = &a; const int *pi = static_cast<const int *>(p); cout << *pi << endl; 输出: 100 void * 转换貌似原来什么类型,再强转回去没啥问题,动态 阅读全文
posted @ 2024-09-22 23:54 double64 阅读(57) 评论(0) 推荐(0) 编辑
摘要:花括号的形式{},进行列表初始化,在C++11中初始化变量到了全面的应用。 可参看《C++ Primer》 P39 P76 P88 等相关内容信息。 Note: 当我们提供一个类内初始值时,必须以符号=或者花括号表示。《C++ Primer》 P246。 如下: class Dog { public 阅读全文
posted @ 2024-09-22 23:13 double64 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <string> #include <memory> #include <vector> #include <thread> #include <queue> #include <functional> #include <mutex> us 阅读全文
posted @ 2024-09-22 14:38 double64 阅读(12) 评论(0) 推荐(0) 编辑
摘要:async 和 future 这个和 C# 的 Task 有点像。 #include <iostream> #include <string> #include <memory> #include <future> #include <thread> using namespace std; int 阅读全文
posted @ 2024-09-22 13:09 double64 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#if 1 #include <iostream> #include <memory> #include <mutex> using namespace std; class Singleton { public: static Singleton &getInstance() { std::cal 阅读全文
posted @ 2024-09-22 12:22 double64 阅读(70) 评论(0) 推荐(0) 编辑
摘要:int main() { constexpr size_t rowCnt = 3, colCnt = 4; int ia[rowCnt][colCnt]; // 使用 for 循环遍历初始赋值 for (size_t i = 0; i != rowCnt; ++i) { for (size_t j 阅读全文
posted @ 2024-09-21 17:01 double64 阅读(15) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 24 下一页
点击右上角即可分享
微信分享提示