随笔分类 -  C++

C++17:结构化绑定(Structured binding)
摘要:https://stubbornhuang.blog.csdn.net/article/details/120740713 #include <iostream> #include <map> #include <tuple> std::pair<int, std::string> getPair( 阅读全文

posted @ 2022-11-02 09:57 OctoberKey 阅读(42) 评论(0) 推荐(0)

c++ std::string转大、小写
摘要:#include <iostream> #include <algorithm> int main() { std::string src = "HELLO, WORLD!"; std::string dst; std::transform(src.begin(), src.end(), std:: 阅读全文

posted @ 2022-10-19 15:42 OctoberKey 阅读(170) 评论(0) 推荐(0)

cpp-properties调试纪要
摘要:报两个错误 std::result_of错误,C++20不支持,提前定义_HAS_DEPRECATED_RESULT_OF 实际用的是Qt5,不支持Q_DISABLE_COPY_MOVE,改为Q_DISABLE_COPY // file: QtCore/qobjectdefs.h, line: 53 阅读全文

posted @ 2022-10-08 15:46 OctoberKey 阅读(127) 评论(0) 推荐(0)

chrono库学习
摘要:参考 C++11 std::chrono库详解 cppreference日期和时间工具 头文件 #include <chrono> 名字空间 using namespace std::chrono; using namespace std::literals::chrono_literals; // 阅读全文

posted @ 2022-09-28 22:00 OctoberKey 阅读(75) 评论(0) 推荐(0)

使用C++11线程延时
摘要:#include <thread> #include <chrono> using namespace std::chrono_literals; using namespace std::this_thread; sleep_for(1ms); 阅读全文

posted @ 2022-09-21 13:02 OctoberKey 阅读(258) 评论(0) 推荐(0)

error C2467: 非法的匿名“struct”声明 —— 解决方法
摘要:问题 包含windows.h文件后,出现这个错误: error C2467: 非法的匿名“struct”声明 具体是这里的问题: // winnt.h ... // Control Flags union { DWORD ControlFlags; struct { DWORD OptimizedS 阅读全文

posted @ 2022-08-12 10:39 OctoberKey 阅读(500) 评论(0) 推荐(0)

error C2813: #import 不支持 /MP —— 解决方法
摘要:问题 用import引入msado15.dll和msadox.dll时,出现以下错误: error C2813: #import 不支持 /MP 解决方法 去**配置属性->C/C++->常规里,设置多处理器编译选型为否**。 可以在整个项目里设置,也可以设置单个cpp文件。 参考 编译器错误 C2 阅读全文

posted @ 2022-08-12 10:28 OctoberKey 阅读(962) 评论(0) 推荐(0)

STL学习(1)——std::equal_to
摘要:说明 std::equal_to 作用 用于比较两个对象或两个值,它能像函数一样被调用,因此可以把它当作参数进行传递。运算符“==”是无法像参数一样被传递的。 用法 可以直接对c++原生类型进行比较,也可以对自定义类型进行比较,自定义类型需要重载“==”运算符。 示例 // equal_to exa 阅读全文

posted @ 2022-08-03 16:53 OctoberKey 阅读(875) 评论(0) 推荐(0)

导航