![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
HockerF
这个作者很懒,什么都没留下…
展开
-
c++ map 的bug, 欢迎大家留言讨论
大该是, 我c ++ map, 如果在 pack 来改变字节对齐的方式, 就会乱.// map_class.h#pragma once#pragma pack(1)#include <map>#include <string>typedef std::map<uint32_t, std::string>::iterator it_image_t;typedef std::map<uint32_t, std::string>::value_typ原创 2022-01-17 11:41:15 · 573 阅读 · 2 评论 -
c++ 二进制左边第一个1的位置
在做数据压缩的时候, 需要找到最小存储单元, 在网上看了,没找到合适的,这里把我想到的一种方式供大家参考。#include <cstdio>#include <iostream>using namespace std;char bin_left_one(u_int64_t num){ char pos = 0; u_int64_t t = num; for(int i = 5; i >= 0; i--){ if(num >原创 2021-12-12 19:25:51 · 1594 阅读 · 0 评论 -
[c/c++] 打印二进制 宏定义
宏定义:#define print_hex(buf,len) do {\ unsigned char* __buf_ptr = (unsigned char*) (buf); \ printf("[%s:%d]%s: ", __FILE__, __LINE__, #buf); \ for( int i = 0; i < (len); i ++){ \ printf("%02X ", __buf_ptr[i]); \ } \ printf(原创 2021-03-19 10:00:05 · 353 阅读 · 0 评论 -
C++ forbids declaration of ‘typeof’ with no type
这个错误有点闹心,因为 C++11 把 关键字typeof改为decltype了。怎么做好两者的兼容性呢,只能使用 if 宏判断来做,比如我的代码:#if __cplusplus >= 201103L#define container_of(ptr, type, member) ({ \ const decltype(((type *)0)->m...原创 2020-03-17 14:36:24 · 761 阅读 · 0 评论 -
opencv4.2 cmake的使用
opencv4.2 cmake的使用。我还是挺支持cmake的,这样windows和linux的项目兼容性就更好。原创 2020-03-17 14:29:21 · 3307 阅读 · 0 评论 -
QT 的模块
说起QT,给我的感觉就是一个C++的编程模式,不会QT就不好说C++道上浪迹过的。有很多博客对QT进行了系统性的梳理,再写一个感觉意义不大,我只是想看看官网上的资料,做一个最新的了解。QT目前不仅仅支持C++接口,还有QMT(多范式语言)和QT for Python。Python版本也非常好用,但最经典的还是C++版本,C++版本的文档是非常全的,功能也是最新的。所以我这里主要看c++版本。Q...原创 2020-01-08 18:46:58 · 451 阅读 · 0 评论