C/C++
OpticalSoliton
这个作者很懒,什么都没留下…
展开
-
STL容器分类
原创 2019-11-03 10:11:56 · 350 阅读 · 0 评论 -
关于operator重载函数是作为成员函数还是friend函数的理解
转载自:https://stackoverflow.com/questions/2337213/return-value-of-operator-overloading-in-cOperator overloading : member function vs. non-member function?问题:I read that an overloaded opera...转载 2019-10-31 11:34:40 · 448 阅读 · 0 评论 -
关于operator运算符是返回值还是返回引用的理解
转载自:https://stackoverflow.com/questions/2337213/return-value-of-operator-overloading-in-creturn value of operator overloading in C++I have a question about the return value of operator overlo...转载 2019-10-31 11:24:54 · 680 阅读 · 0 评论 -
String类实现的一个简单Demo
一个简单的String类的实现,转载自:http://www.ccs.neu.edu/home/sbratus/com1101/mystring.txt//// myString is an (inefficient) implementation of a string class.// It's only purpose is to provide an example of...转载 2019-10-31 11:16:15 · 293 阅读 · 0 评论 -
数据结构
树的分类:1.二叉树:如果不对其中的元素进行排序,则不利于查找2.二叉查找树(Binary Search Tree)节点按照一定的顺序排列:对于二叉查找树中的所有结点X, 它的左子树的所有项的值小于X中的项,而它的右子树中的所有项大于X中的项。查找效率更高,但因为根节点是固定的,所以受数据的分布规律影响会不平衡,造成复杂度的方差太大。比如可能会退化为成链表形式,比如一个二叉树...原创 2019-08-19 15:31:55 · 121 阅读 · 0 评论 -
各种stream
1. ifstream和ofstream#include<iostream>#include<fstream>int main(){ //std::ofstream::in File open for reading //std::ofstream::out File open for writing //std::ofstream::binary ...原创 2018-10-31 00:33:00 · 277 阅读 · 0 评论 -
基本的图像处理操作
1. Mask operation官网Mask操作的效果决定于其使用的Mask, 通過Mask在圖像上逐個像素的便利,得到當前像素的新的值.比如增强对比度(銳化)的:实现方法:void Sharpen(const cv::Mat& myImage, cv::Mat& Result){ CV_Assert(myImage.depth() == CV...翻译 2019-08-20 18:36:25 · 282 阅读 · 0 评论 -
namespace中声明和定义C函数出现error: multiple definition of ...
定义一个C函数,如下//.h文件namespace Test{ class bird { public: void birdFly() { std::cout << "bird fly" << std::endl; } }; void birdDo(...原创 2019-09-04 15:23:55 · 665 阅读 · 0 评论 -
C/C++编程注意事项
1. 防止头文件的重复包含#ifndef __TEST_H__#define __TEST_H__class Test{public: Test();};#endif // __TEST_H__否则会显示, 常见的error: redefinition of ‘class Test’ error: previous definition...原创 2019-09-10 20:06:41 · 688 阅读 · 0 评论 -
类型cast
1. static_caststatic_cast:This is used for the normal/ordinary type conversion. This is also the cast responsible for implicit type coersion and can also be called explicitly. You should use it in ...原创 2019-09-26 14:02:38 · 142 阅读 · 0 评论 -
auto_ptr, unique_ptr, shared_ptr的使用
https://www.geeksforgeeks.org/auto_ptr-unique_ptr-shared_ptr-weak_ptr-2/#include <memory>#include <iostream>class A{public: void show(void) { std::cout << "A:...原创 2019-10-09 12:58:52 · 128 阅读 · 0 评论 -
线程池
转载自:https://blog.csdn.net/u013507368/article/details/48130151?utm_source=blogxgwz0 #pragma once#include <iostream>#include <deque>#include <thread>#include <mutex>...转载 2018-10-29 23:11:42 · 152 阅读 · 0 评论 -
条件变量
1#include<iostream>#include<thread>#include<mutex>#include<condition_variable>#include<queue>#include<chrono>std::mutex mtx;std::condition_variable conVa...原创 2018-10-23 23:34:29 · 120 阅读 · 0 评论 -
死锁示例
void print_one(){while(true){mtx_one.lock(); //这句执行结束的时候去锁住mtx_two,而mtx_two被thread_two锁住mtx_two.lock();std::cout &amp;amp;amp;lt;&amp;amp;amp;lt; “print_one” &amp;amp;amp;lt;&amp;amp;amp;lt; std::endl;mtx_two.unloc原创 2018-10-23 00:13:12 · 280 阅读 · 0 评论