
c++
文章平均质量分 59
ztenv
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++中锁类型对比与实战
C++多线程编程中的三种锁机制对比:std::lock_guard适合简单的互斥场景,RAII机制保证自动解锁;std::unique_lock功能更灵活,支持延迟锁和条件变量;std::shared_lock(C++17+)专为读多写少场景设计,允许多线程并发读取。性能上,lock_guard最快,unique_lock因额外功能开销稍大。实战中应根据具体场景选择锁类型:简单保护用lock_guard,条件变量用unique_lock,读多写少用shared_lock,高并发写可分片优化。合理使用这些锁能原创 2025-06-04 10:04:44 · 461 阅读 · 0 评论 -
undefined reference的问题(同时链接静态,动态库可能导致的问题)
项目中,往往会同时链接.a文件和.so文件,当项目比较庞大的时候,就会出现很难保证.a文件的链接顺序的情况,由于.a文件对链接顺序有较高的要求,所以可能会出现即使指定了相应的.a。原创 2025-04-30 11:01:12 · 358 阅读 · 0 评论 -
c++code coverage tools working with cmake
【代码】c++code coverage tools working with cmake。原创 2025-03-05 16:03:14 · 346 阅读 · 0 评论 -
The difference between exit/abort/_Exit/return/quick_exit
【代码】The difference between exit/abort/_Exit/return/quick_exit。原创 2025-01-14 17:49:50 · 807 阅读 · 0 评论 -
Step-by-step guide to learn c++
Learning C++ can be both exciting and rewarding. Here’s a step-by-step guide and recommendations for books to help you get started:“Programming: Principles and Practice Using C++” by Bjarne Stroustrup“C++ Primer (5th Edition)” by Stanley B. Lippman, Josée原创 2025-01-14 17:44:40 · 852 阅读 · 0 评论 -
Broti(BR) Algorithm Overview
Brotli is a lossless compression algorithm optimized for web use. It is particularly effective for text-based data like HTML, CSS, and JavaScript, offering high compression ratios with efficient decompression. Developed by Google, Brotli combines modern co原创 2025-01-13 11:24:16 · 725 阅读 · 0 评论 -
C++26目前常见特性
【代码】C++26目前常见特性。原创 2025-01-10 09:11:51 · 1063 阅读 · 0 评论 -
C++ and Rust之争,谁才是王者
【代码】C++ and Rust之争,谁才是王者。原创 2025-01-10 09:06:22 · 835 阅读 · 0 评论 -
boost multi_index_container详解(这一篇就够了)
有序STL容器无法提供此功能,这通常会导致不优雅的变通方案:例如,考虑确定ID在[0,100]范围内的员工的问题。的每个索引都使用自己的迭代器类型,这些类型与其他索引的迭代器类型不同。此外,细心的程序员必须考虑到搜索区间的下界和上界必须兼容:例如,如果下界是200,上界是100,则上面代码生成的迭代器。任何类型都可以用作索引的标记,尽管通常会选择与其关联的索引描述性名称。的类似物,事实上,它们确实复制了其接口,尽管 Boost.MultiIndex 的一般约束导致了一些细微的差异。原创 2025-01-09 17:44:14 · 1614 阅读 · 0 评论 -
boost::multi_index_container 详解
【代码】boost::multi_index_container 详解。原创 2025-01-09 08:30:00 · 862 阅读 · 0 评论 -
用c/c++实现deflate的压缩
【代码】用c/c++实现deflate的压缩。原创 2024-12-30 15:45:00 · 334 阅读 · 0 评论 -
用c/c++实现gzip压缩
【代码】用c/c++实现gzip压缩。原创 2024-12-30 11:08:32 · 322 阅读 · 0 评论 -
Order evaluation Rules in C++17
【代码】Order evaluation Rules in C++17。原创 2024-09-19 09:45:00 · 737 阅读 · 0 评论 -
The concept of the Sequenced before, also including the 20 important rules
This is。原创 2024-09-19 09:00:00 · 1485 阅读 · 0 评论 -
The concept of the Sequence point
sequencing。原创 2024-09-18 09:45:00 · 919 阅读 · 0 评论 -
The concept of the Happened-before
【代码】The concept of the Happened-before。原创 2024-09-18 09:00:00 · 651 阅读 · 0 评论 -
A Walkthrough Using Acquire and Release Fences
We’ll take the example from my previous post and modify it to use C++11’s standalone acquire and release fences. Here’s the SendTestMessage function. .Here’s the function. . .Now, if happens to see the write which performed on , then . Again, strictly原创 2024-09-12 09:00:00 · 1922 阅读 · 0 评论 -
specify which reordering operations are permitted and which are not
【代码】specify which reordering operations are permitted and which are not with std::atomic_thread_fence。原创 2024-09-11 10:00:00 · 888 阅读 · 0 评论 -
produce and consumer based on the std::thread_fence
【代码】produce and consumer based on the std::thread_fence。原创 2024-09-11 09:00:00 · 438 阅读 · 0 评论 -
To explain the std::atomic_thread_fence and some demos
【代码】another std::atomic_thread_fence demo。原创 2024-09-10 09:30:00 · 317 阅读 · 0 评论 -
std::atomic_thread_fence description and a simple demo
【代码】std::atomic_thread_fence description and a simple demo。原创 2024-09-10 08:30:00 · 648 阅读 · 0 评论 -
several solutions of producer and consumer
【代码】several solutions of producer and consumer。原创 2024-09-09 09:00:00 · 587 阅读 · 0 评论 -
producer and consumer based on the std::atomic_flag
【代码】producer and consumer based on the std::atomic_flag。原创 2024-09-09 08:30:00 · 308 阅读 · 0 评论 -
counter based on std::atomic
【代码】counter based on std::atomic。原创 2024-09-08 06:00:00 · 254 阅读 · 0 评论 -
producer and consumer based on the std::atomic
【代码】producer and consumer based on the std::atomic。原创 2024-09-08 07:00:00 · 422 阅读 · 0 评论 -
深入理解CMake
深入理解cmake原创 2024-08-13 10:48:46 · 1059 阅读 · 1 评论 -
通过设置gcc的flags来捕获异常
然后,就可以不使用gdb来调试即可打印堆栈等详细信息了。即可实现运行程序时捕获异常的目的。原创 2024-07-18 16:55:16 · 252 阅读 · 0 评论 -
linux平台方便的获取当前进程名字的几种方法
vim /proc/pid/status #可以获取name。在main函数中使用变量。在main函数中调用。原创 2024-07-18 10:20:54 · 1412 阅读 · 1 评论 -
编译器对C++23的支持程度
详见这里原创 2024-07-02 14:59:05 · 663 阅读 · 0 评论 -
C++23特性一览
【代码】C++23特性一览。原创 2024-07-02 14:53:14 · 1351 阅读 · 2 评论 -
cmake通过PkgConfig查找没有提供cmake的库,并在cmakelists.txt中进行依赖(如:ffmpeg等)
【代码】cmake通过PkgConfig查找没有提供cmake的库,并在cmakelists.txt中进行依赖(如:ffmpeg等)原创 2024-06-02 22:14:58 · 251 阅读 · 0 评论 -
C++23主要特性
c++23主要特性原创 2023-02-16 17:18:00 · 635 阅读 · 0 评论 -
#直播预告 “C++王者归来”系列大咖对谈,带你了解新时代的C++编程语言。2月16、18日19点两场重磅直播欢迎 #视频号:IT阅读排行榜 观看
#直播预告 “C++王者归来”系列大咖对谈,带你了解新时代的C++编程语言。2月16、18日19点两场重磅直播欢迎 #视频号:IT阅读排行榜 观看原创 2023-02-16 09:13:07 · 252 阅读 · 0 评论 -
c++连接mariadb/mysql 数据代码
【代码】c++连接mariadb/mysql 数据代码。原创 2023-02-13 21:26:54 · 584 阅读 · 0 评论 -
简单的有限状态机(FSM)示例二(订阅多个事件,同一个状态可以转换为多个不同的状态)
由此可以,实现了比上次稍微复杂一点的状态机:同一个状态可以向多个不同的状态进行转换。为了保持与前续的一致,所以我们这里依然基于boost的状态机来实现。原创 2022-12-27 11:49:09 · 651 阅读 · 0 评论 -
简单的有限状态机(FSM)的示例一
使用if-else或switch-case判断并设置状态之间的转换,比较小儿科,如果写不好会有很多很多的bug,最后当状态变得很多很复杂的时候,bug可能不好找完,尤其是在加入新的状态以后.有一个明显的优点:就是想怎么改就怎么改,容易上手。有一个明显的缺点:很难扩展新的状态,增加新的事件。原创 2022-12-09 17:45:37 · 685 阅读 · 2 评论 -
手把手教你配置vscode的c++开发环境(wsl + 远程)
一定记得在linux安装gcc/g++开发环境一定记得在linux安装gdb调试工具,有些默认没有安装,即使正确配置了launch.json和task.json,也会报错。。。原创 2022-11-05 12:03:23 · 4542 阅读 · 0 评论 -
手把手教你配置vscode+wsl开发环境
【代码】手把手教你配置vscode+wsl开发环境。原创 2022-11-05 11:13:57 · 3229 阅读 · 0 评论 -
一个好用的double-convertion和bignum库
https://github.com/google/double-conversion原创 2022-11-01 10:44:02 · 454 阅读 · 0 评论 -
C/C++好用的websocket库
libwebsockets原创 2022-09-18 15:51:31 · 4633 阅读 · 0 评论