随笔分类 - C/C++
C/C++ 相关学习及应用
摘要:0.0 扉页 项目主页 Google Style Guide Google 开源项目风格指南 -中文版 0.1 译者前言 Google 经常会发布一些开源项目, 意味着会接受来自其他代码贡献者的代码. 但是如果代码贡献者的编程风格与 Google 的不一致, 会给代码阅读者和其他代码提交者造成不小的
阅读全文
摘要:#1.3 链表 ##1.3.1 头插法建立单链表 #include <stdio.h> #include <stdlib.h> typedef char datatype; typedef struct node{ datatype data; struct node *next; } listno
阅读全文
摘要:对多个值取最值 C++标准库提供了获取最大值和最小值的方法: int mi = std::min(x1, x2); int ma = std::max(x1, x2); 如果想获取超过两个数的最值呢? 可以使用嵌套的方法,比如这样: int mi = std::min(x1, std::min(x2
阅读全文
摘要:// 最基本实现 template<typename T> static void print(T t) { std::cout << t; } // 处理 std::pair template<typename Kt, typename Vt> static void print(std::pai
阅读全文
摘要:#include <sstream> #include <iostream> #include <iomanip> using namespace std; /** * 四舍五入保留到n位小数 * @param number * @param bits * @return */ static dou
阅读全文
摘要:#include <iostream> #include <string> using namespace std; /** * 截取str后的元素 * @param stream 待截取字符串 * @param str 截取定位字符串 * @return */ static auto cutNex
阅读全文
摘要:#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; /** * vector去除重复元素 * @tparam T * @param result * @retur
阅读全文
摘要:// // Created by leoxae on 2020/3/30. // #include "BarCodeRecogntion.h" string BarCode::BarCodeRecognition(Mat image) { string result; zbar::ImageScan
阅读全文
摘要:Effective C++ 视C++ 为一个语言联邦(C、Object-Oriented C++、Template C++、STL) 宁可以编译器替换预处理器(尽量以const、enum、inline替换#define) 尽可能使用const 确定对象被使用前已先被初始化(构造时赋值(copy 构造
阅读全文
摘要:#include <iostream> #include <thread> #include <mutex> #include <iostream> // std::cout, std::endl #include <future> // std::async, std::future #inclu
阅读全文