
Cpp
.云哲.
向善,求实,藏锋,隐智,戒欲,省身,慎言。
展开
-
【c++】 vector 添加和去重
#include <iostream>#include <vector>using namespace std;struct Track { int num;};vector<Track> sort_track(vector<Track> dets) { cout << "-------" << endl; for (int i = 0; i < dets.size(); i++) { cout &l原创 2022-03-16 16:21:28 · 1852 阅读 · 0 评论 -
【Cpp】C语言使用静态库
1,文件目录root@rose-machine:~/test# tree.|-- hello.c|-- hello.h|-- hello.o|-- libadd.a|-- main`-- main.c2,创建hello.h和hello.c2.1. hello.h#ifndef __HELLO__#define __HELLO__int add(int a, int b);#endif2.2 hello.cint add(int a, int b){ return原创 2020-11-19 10:08:33 · 502 阅读 · 0 评论 -
【Cpp】nms demo
代码#include <iostream>#include <vector>#include <algorithm>#include <opencv2/opencv.hpp>using namespace std;using namespace cv;double IOU(const Rect& r1, const Rect&...原创 2019-10-31 17:24:03 · 190 阅读 · 0 评论 -
C++ STL map4中不同的insert
#include<iostream>#include<map>using namespace std; int main(){ map<int, string> mp; //方法1.pair<int, string> pair<map<int,string>::iterator, bool&...原创 2019-06-10 18:04:01 · 158 阅读 · 0 评论 -
C 创建线程的简单例子
1,thread_test.c#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <pthread.h>// 线程Avoid* print_a(void *a){ int i; for(i=...原创 2019-06-09 15:18:16 · 627 阅读 · 0 评论 -
C++11 bind函数
int Func(int x, int y) { return x + y;}class T{public: int Func(int x, int y) { return x + y; }};int main() { auto bf1 = std::bind(Func, 10, std::placeholders::_1); std::cout <<...原创 2019-06-08 17:40:03 · 1256 阅读 · 0 评论 -
C++11 packaged_task,函数指针类型
std::string getData(std::string token){std::string data = “Data :” + token;return data;}int main(){// 创建封装回调的packaged_task<函数指针>std::packaged_taskstd::string(std::string) task(getDataFro...原创 2019-06-08 17:33:28 · 258 阅读 · 0 评论 -
C++ new和delete对象
class A { public: static void *operator new(size_t size); static void operator delete(void *phead); //static void *operator new[](size_t size); //static void operator delete[](void *phead);...原创 2019-05-24 10:02:26 · 984 阅读 · 0 评论 -
C++ 结构体数据读取文件
namespace _02{ struct student { char name[20]; char sex[20]; int age; }; vector<string> split(const string& src, string delimit, string null_subst = "") { typedef basic_string...原创 2019-04-27 20:24:16 · 2109 阅读 · 0 评论 -
C++ 结构体数据写入文件
namespace _02{ struct student { char name[20]; char sex[20]; int age; }; void run() { const int num = 2; student stu[num]; string path = "D://1.txt"; fstream fout(path, ios::out|i...原创 2019-04-27 20:22:10 · 6601 阅读 · 2 评论