随笔分类 -  c++

找出数组中只出现一次的唯一值
摘要:// Example program #include <iostream> #include <string> int main() { int a[9] = {109,239,3432,8981,-7,109,239,3432,8981}; int ans = 0; for(auto t : a 阅读全文

posted @ 2020-08-21 15:26 庭中核桃树 阅读(276) 评论(0) 推荐(0)

没有中间变量的值交换
摘要:// Example program #include <iostream> #include <string> void swap(int & a, int & b) { a ^= b ^= a ^= b; } int main() { int a = 10; int b = 100; swap( 阅读全文

posted @ 2020-08-20 17:23 庭中核桃树 阅读(123) 评论(0) 推荐(0)

std::vector<bool> 的要点
摘要:#include <iostream> #include <vector> #include <memory.h> #include <stdio.h> int main() { int size_v = 10; std::vector<int> tmp(5, 0); int * tmp_pt = 阅读全文

posted @ 2020-08-20 09:03 庭中核桃树 阅读(499) 评论(0) 推荐(0)

C++ const 关键字修饰常量
摘要:// Example program #include <iostream> #include <string> int main() { char hello[] = "helloworld!"; int tmp = 6; int other = 7; const int * a = &tmp; 阅读全文

posted @ 2020-08-13 22:18 庭中核桃树 阅读(200) 评论(0) 推荐(0)

OpenCV Mat 类型定义详解
摘要:#define CV_8U 0 #define CV_8S 1 #define CV_16U 2 #define CV_16S 3 #define CV_32S 4 #define CV_32F 5 #define CV_64F 6 #define CV_USRTYPE1 7 #define CV_ 阅读全文

posted @ 2020-08-07 17:14 庭中核桃树 阅读(612) 评论(0) 推荐(0)

一个关于const 变量作为map键值的Bug
摘要:这里当使用 cons Instance 调用函数时,只可以使用 const Attribute 作为键值,但是 map [] 运算符不是const函数,因此会报错,使用 map 的 at 方法可以避免,因为 既有const 定义,又有非const 定义. "参考" 阅读全文

posted @ 2020-01-16 12:27 庭中核桃树 阅读(584) 评论(0) 推荐(0)

CMake 文件 link_directories() 使用相对路径失败的问题
摘要:今天再编译工程时,遇到了这个问题: Policy CMP0015 is not set: link_directories() treats paths relative to the source dir. 看到了这一篇 "博客" 解决了这个问题,核心如下: In CMake 2.8.0 and 阅读全文

posted @ 2019-09-26 23:43 庭中核桃树 阅读(9154) 评论(0) 推荐(1)

unorderd_map 自定义键值及哈希函数的重载
摘要:参考链接: https://blog.csdn.net/y109y/article/details/82669620 阅读全文

posted @ 2019-04-16 09:16 庭中核桃树 阅读(487) 评论(0) 推荐(0)

三次贝塞尔曲线生成 C++ 代码
摘要:cal_angle 求分辨率为 _resolution 的时候每一点的切线方向。 阅读全文

posted @ 2019-03-26 20:42 庭中核桃树 阅读(2735) 评论(0) 推荐(0)

导航