上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 56 下一页
摘要: ▲ 容器操作 《C++ Primer》 P295 阅读全文
posted @ 2024-09-26 07:59 double64 阅读(13) 评论(0) 推荐(0)
摘要: ▲ 顺序容器类型 《C++ Primer》 P294 阅读全文
posted @ 2024-09-26 07:37 double64 阅读(10) 评论(0) 推荐(0)
摘要: IO 库: istream(输入流)类型,提供输入操作。 ostream(输出流)类型,提供输出操作。 cin,一个istream对象,从标准输入读取数据。 cout,一个ostream对象,向标准输出写入数据。 cerr,一个ostream对象,通常用于输出程序错误消息,写入到标准错误。 >>运算 阅读全文
posted @ 2024-09-24 23:02 double64 阅读(21) 评论(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 阅读(173) 评论(0) 推荐(0)
摘要: 花括号的形式{},进行列表初始化,在C++11中初始化变量到了全面的应用。 可参看《C++ Primer》 P39 P76 P88 等相关内容信息。 Note: 当我们提供一个类内初始值时,必须以符号=或者花括号表示。《C++ Primer》 P246。 如下: class Dog { public 阅读全文
posted @ 2024-09-22 23:13 double64 阅读(25) 评论(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 阅读(23) 评论(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 阅读(24) 评论(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 阅读(180) 评论(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 阅读(53) 评论(0) 推荐(0)
摘要: ▲《C++ Primer》 P109 我们无法保证 c_str 函数返回的数组一直有效,事实上,如果后续的操作改变了 string 的值就可能让之前返回的数组失去效用。 WARNING: 如果执行完 c_str() 函数后程序想一直都能使用其返回的数组,最好将该数组重新拷贝一份。 阅读全文
posted @ 2024-09-21 15:51 double64 阅读(9) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 56 下一页