随笔分类 -  C++

摘要:1. linux内核的自旋锁: 参考 参考 Qt里的原子操作 gcc内置的cas操作: 官方 参考 futex的设计与实现: 参考 c++的atomic是真正的原子吗? 参考 // cas: g++ test.cc -lpthread -march=nocona -mtune=generic // 阅读全文
posted @ 2021-06-24 14:14 AlexOne 阅读(147) 评论(0) 推荐(0)
摘要:1. Hash乃是对键值的hash,不涉及value。提升的是查找key的效率。 将value存为地址,如此便能使用哈希存储更丰富的信息。 和map相比,查找速度提升了不少,但是程序的复杂度也提升了一些。 #include <iostream> #include <map> #include <ha 阅读全文
posted @ 2020-05-07 22:16 AlexOne 阅读(180) 评论(0) 推荐(0)
摘要:#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; class BitArray2D { private: int mRow, mCol; unsign 阅读全文
posted @ 2020-04-26 16:25 AlexOne 阅读(429) 评论(0) 推荐(0)