自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

转载 代理模式和适配器模式的区别

适配器模式#include <iostream>using namespace std;class subject{public: virtual void request()=0;};class adaptee{public: void specialRequest(){ cout <&lt...

2018-11-15 10:29:00 223

转载 C++设计模式之观察者模式

//观察者模式class Observer{public: virtual void Updata() = 0;};class Subject{public: void Attach(Observer* in){ m_list.push_back(in); } void Detach(Observer* out){ m_list....

2018-10-01 16:26:00 123

转载 京东选择-函数指针

void(*function)(float);void One(float one){ cout << one << endl;}void Two(float two){ cout << two << endl;}void Three(float three){ cout <&lt...

2018-09-09 21:43:00 156

转载 类静态成员变量和静态成员函数的访问方式

1、在类所有实例中静态成员变量和静态成员函数都只有一份拷贝2、静态成员函数不能调用非静态成员,非静态成员函数可以调用静态成员3、静态成员变量在使用前要初始化一、静态成员变量的访问class B{public: static int a;};int B::a=0;//必须要先初始化int main(){ cout<&...

2018-08-30 17:03:00 1381

转载 C语言unoin用法

union{ short int i; char x[2];}a;void main(){ cout << sizeof(a) << endl; //自然顺序3210 a.x[1] = 0x11; a.x[0] = 0x00; printf("%x\n", a.i); a...

2018-08-29 09:19:00 280

转载 const char*和char* const的区别

const char*1、字符串相对于指针是常量,但字符串本身不是常量2、指针能够被重定向int main(){ char str1[] = "hello world"; char str2[] = "ni hao"; const char* ptr = str1; //ptr[0] = 'H';//字符串相对于指针是常量 ...

2018-08-29 08:31:00 988

转载 C++ stack增删

int main(){ stack<int> test; //插入 test.push(1); test.push(2); test.push(3); //删除 test.pop(); cout << test.size() << endl; while ...

2018-08-24 15:55:00 232

转载 C++ set增删改查遍历

int main(){ set<int> test; //插入 test.insert(2); test.insert(1); test.insert(4); test.insert(5); test.insert(3); //遍历 for (auto i : test) ...

2018-08-24 15:31:00 344

转载 C++ vector增删改查遍历排序去重

int main(){ vector<int> test; //插入 test.push_back(0); test.insert(test.begin(),1);//在迭代器之前插入 test.insert(test.end(), 3, 2); //遍历 for (auto i : test)...

2018-08-24 10:59:00 398

转载 C++ list增删改查遍历反转排序

int main(){ list<int> test; //插入 test.push_back(1); test.push_back(1); test.push_front(0); test.push_back(2); auto it = test.begin(); for (...

2018-08-24 10:03:00 415

转载 C++ map增删改查遍历

int main(){ typedef map<int, string> myMap; myMap test; //插入 test.insert(pair<int, string>(1, "a")); test.insert(pair<int, string>(2, "b")); te...

2018-08-23 21:49:00 696

转载 vector删除中间某一元素

int main(){ vector<int> a(10); int count = 0; cout << a.size() << endl; cout << a.capacity() << endl; for (auto &i : a) {...

2018-08-23 16:30:00 1030

转载 手撕构造函数、拷贝构造函数、赋值运算符重载、析构函数

class A{public: A(int n):m_n(n){ m_ptr = new int(m_n); } A(const A& x){ m_n = x.m_n; m_ptr = new int(m_n); memcpy(m_ptr, x.m_ptr, size...

2018-08-23 14:44:00 148

转载 public/protect/private和公有继承/保护继承/私有继承的简单理解

一、先来看一下没有继承的情况类中的变量访问:(1)类内访问方式:通过public成员函数访问(2)类外访问方式:直接访问表 1class A{public: int a;protected: int b;private: int c;public: int getAll(){ ...

2018-08-12 19:04:00 192

转载 简述Sunday算法

Sunday算法是字符串匹配算法,我从Pcie板卡收上来一包图像数据,通过sunday算法定位帧头00aa0055来确定哪里是图像的开始。假设有一模式串与主串,模式串长度为m,主串长度为n,当前位置为s。如果当前位置模式串与主串不能够匹配,再看主串s+m位是否存在于模式串中,如果存在向后移动将这两位对齐,如果不存在向后移动m+1位,重复上述操作直到完全匹配。参考:https:...

2018-08-10 10:58:00 149

转载 简单工厂模式和策略模式对比C++版本-大话设计模式

简单工厂模式和策略模式的区别?简单工厂模式的实例化由工厂类来实现,用户只需要传递一个条件,由工厂生产出相应的类;策略模式需要用户自己实例化类,传递的是实例化的对象。简单工厂模式//简单工厂模式class drink{public: virtual void getResult(){}};class caffe:public drin...

2018-08-03 16:23:00 146

转载 单例模式--懒汉模式、内部静态变量懒汉模式、饿汉模式

单例模式(singleton),保证一个类仅有一个实例,并提供一个访问它的全局访问点。1、懒汉模式class Singleton{private: Singleton(){} static Singleton *p;public: static Singleton* getInstance(){ if (p == n...

2018-08-03 10:23:00 395

转载 大话设计模式--装饰模式 C++简单例子

装饰者模式最简化模型class decorator{public: decorator *m_a; virtual void show(){ cout << "汤姆: "; }};class Tshirt : public decorator{public: Tshirt(decor...

2018-07-27 22:23:00 116

转载 c++使用cuda对图像进行简单处理

CUDA的sample用的是openGL,初次接触有点看不懂,于是用opencv代替先进行简单的处理,学习就是循序渐进嘛。//核函数__global__ void chessboard(uint* input, uint *output, int w, int h){ int x = blockIdx.x*blockDim.x + threadIdx.x; ...

2018-02-07 11:02:00 880

转载 基于fftw的二维FFT实现

作者使用的fftw版本为3.3.5fftw官网下载地址http://www.fftw.org/install/windows.html#include "fftw3.h"#include <stdio.h>#include <stdlib.h>#include <opencv2/opencv.hpp>#include &lt...

2018-02-02 18:36:00 769

转载 cuda中二维FFT使用-cufftExecC2C

#include <stdlib.h>#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#include "cuda_runtime.h"#include "device_launch_parameters...

2018-02-02 18:08:00 3504

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除