随笔分类 -  C++

c++(6)----移动语义
摘要:为什么需要移动语义 一些场景 #include <iostream> #include <cstring> using namespace std; class A{ public: A():i(new int[20]){ cout<<"class A construct!"<<endl; } A( 阅读全文

posted @ 2020-02-02 15:14 feihu_h 阅读(252) 评论(0) 推荐(0)

c++(5)----数组指针 和 指针数组
摘要:int a[10]; printf("整个数组的地址a:%d\n",&a); printf("数组的首元素的地址a:%d\n,a); 数组的名称为数组首元素的地址。 数组首元素的地址和数组的地址值相等。 数组指针 数组的类型由元素类型和数组大小共同决定 int (*array_point)[4]; 阅读全文

posted @ 2020-01-28 20:44 feihu_h 阅读(130) 评论(0) 推荐(0)

c++(4)----指针和引用、const
摘要:指针和引用都是一种复合类型。 复合类型: 基于其他类型定义的类型 基本数据类型+声明符 引用并非对象,而是一个别名,定义时必须初始化 // 引用并非对象,而是一个别名 int ival =1024; int &refVal = ival; // refVal 指向ival(是ival的另一个名称) 阅读全文

posted @ 2020-01-28 19:47 feihu_h 阅读(252) 评论(0) 推荐(0)

c++(3)----变量的声明和定义
摘要:分离式编译(separate compilation): 允许将程序分割为若干个文件,每个文件可独立编译。 声明:使得名字为程序所知。 定义:负责创建与名字关联的实体。 变量只能被定义一次,但可以被声明多次。 如果要在多个文件中使用同一个变量,就必须将声明和定义分离。此时,变量的定义必须出现在且只能 阅读全文

posted @ 2020-01-28 13:19 feihu_h 阅读(320) 评论(0) 推荐(0)

C++(2)----智能指针与动态内存
摘要:C++ 11提供的智能指针有:shared_ptr、unique_ptr、weak_ptr。在 头文件 memory 中。 一、new delete 直接管理内存 1、初始化 string * ps = new string // 初始换为一个空string int * pi = new int ; 阅读全文

posted @ 2020-01-28 09:31 feihu_h 阅读(255) 评论(0) 推荐(0)

c++(1)----堆内存、栈内存
摘要:一、在C++内存管理中: 动态分配内存的区域称之为堆内存。 new 和 delete 操作的区域是 free store(heap 的子集) malloc 和 free 操作的区域是 heap 函数调用过程中产生的本地变量和调用数据的区域称之为栈。 二、堆内存: 动态内存分配有一定的不确定性(分配时 阅读全文

posted @ 2020-01-17 13:54 feihu_h 阅读(340) 评论(0) 推荐(0)

libjpeg(1)----读取图像
摘要:安装libjpeg: sudo apt-get install libjpeg-dev demo #include <iostream> #include <jpeglib.h> #include <memory.h> #include <stdio.h> #include <stdlib.h> i 阅读全文

posted @ 2019-12-31 13:36 feihu_h 阅读(423) 评论(0) 推荐(0)

ROS基础-基本概念和简单工具(1)
摘要:ROS编程,基本概念和常用工具,创建包(catkin_create_pkg),编译、运行等 ;roslaunch、rqt_graph 阅读全文

posted @ 2019-11-13 00:34 feihu_h 阅读(1045) 评论(0) 推荐(0)

导航