c++
向天再借五百亿
不会写代码的程序员
展开
-
linux c++遍历文件夹下文件
linux系统下c++遍历文件夹下文件原创 2022-12-05 16:20:37 · 1157 阅读 · 2 评论 -
c++计算程序执行时间
c++计算程序执行时间原创 2022-11-16 17:54:24 · 231 阅读 · 0 评论 -
c++单例写法
c++单例写法原创 2022-10-26 13:18:38 · 494 阅读 · 0 评论 -
pybind11案例
pybind11使用教程原创 2022-10-20 17:14:46 · 251 阅读 · 0 评论 -
undefined reference to `google::protobuf::internal::VerifyVersion(int, int, char const*)‘ 错误解决方法
解决方法:在工程CMakeLists.txt中添加find_package(Protobuf REQUIRED)include_directories(${PROTOBUF_INCLUDE_DIR})target_link_libraries(main student ${PROTOBUF_LIBRARY})原创 2022-04-21 14:05:04 · 1182 阅读 · 1 评论 -
c++ 对结构体分级排序
对于结构体分级排序,例如:typedef struct Point{ int x; int y; float z; int index;}Point;现在要将vector<Point>数据按照x从小到大,y从小到大,z从大到小排序。解决方法:利用运算符重载。typedef struct Point{ int x; int y; float z; int index; bool operator < (const Point &b){ if(x !=原创 2022-04-13 16:38:31 · 994 阅读 · 0 评论 -
linux clock函数
由于之前踩坑,发现clock计时不准确。特意记录一下程序计时方法。结论:程序计时使用c++ 11的chrono,不要使用clock。原文链接:c++异步处理和clock函数踩坑1. 异步处理异步处理,在本文,只是为了多线程加速程序运行速度。异步处理一般需要有如下步骤,1.1 确认或者封装需要异步处理的函数这个过程可以理解为,将一个运行速度慢,需要加速的部分,拆解为很多小模块,每个小模块自身比较快。那么,在每个线程中,只运行这个小块,多个线程同时工作的时候,总体的时间就会比较少。1.2 调用异原创 2022-04-11 17:04:21 · 1477 阅读 · 0 评论 -
c++ lambda函数
c++ lambda函数能够提升性能,减少函数开销例子如下:#include <iostream>#include <time.h>using namespace std;#define N 10000000void test(){ for(int i = 0; i < N; i++){}}int main(){ clock_t start, end; start = clock(); test(); end =原创 2022-04-11 11:25:27 · 1219 阅读 · 1 评论