<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[路漫漫其修远兮]]></title><description><![CDATA[每天学一点！]]></description><link>https://blog.csdn.net/songsong2017</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; songsong2017]]></copyright><item><title><![CDATA[C++显示调用构造函数和析构函数]]></title><link>https://blog.csdn.net/songsong2017/article/details/103937747</link><guid>https://blog.csdn.net/songsong2017/article/details/103937747</guid><author>songsong2017</author><pubDate>Sat, 11 Jan 2020 16:16:24 +0800</pubDate><description><![CDATA[文章目录直接通过&lt;类名&gt;::构造函数或析构函数通过placement new
类在new的时候其实做了两件事情：
（1）调用malloc分配所需的内存（实际上是调用operator new）
（2）调用构造函数
类在delete的时候其实也做了两件事：
（1）调用析构函数
（2）调用free释放内存（实际上是调用operator delete）
直接通过&lt;类名&gt;::构造函数...]]></description><category></category></item><item><title><![CDATA[define与typedef、const、inline的区别]]></title><link>https://blog.csdn.net/songsong2017/article/details/103936865</link><guid>https://blog.csdn.net/songsong2017/article/details/103936865</guid><author>songsong2017</author><pubDate>Sat, 11 Jan 2020 15:10:36 +0800</pubDate><description><![CDATA[define与typedef区别
  define是宏定义，typedef是重命名。
typedef int int_32;
typedef void(*Func)(int);  // Func为一个函数指针
#define PI 3.1415   // 宏定义没有；
#define max(x,y) ((x)&gt;(y)?(x):(y)) 

作用域不同

typedef

（1）如果放在所有...]]></description><category></category></item><item><title><![CDATA[堆和栈]]></title><link>https://blog.csdn.net/songsong2017/article/details/103936385</link><guid>https://blog.csdn.net/songsong2017/article/details/103936385</guid><author>songsong2017</author><pubDate>Sat, 11 Jan 2020 14:33:07 +0800</pubDate><description><![CDATA[文章目录简介为什么栈向下增长为什么栈要比堆快为什么要使用栈来保存函数参数或者局部变量如何验证栈的增长方向栈帧函数参数压栈顺序栈溢出栈溢出例子
简介
  C/C++，一般内存模型从低到高分别为：text代码段，data全局/静态已初始区域，bss全局/静态未初始化区域，heap堆，stack栈，内核区。如下图所示
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SOXh...]]></description><category></category></item><item><title><![CDATA[指针和引用的区别]]></title><link>https://blog.csdn.net/songsong2017/article/details/103936040</link><guid>https://blog.csdn.net/songsong2017/article/details/103936040</guid><author>songsong2017</author><pubDate>Sat, 11 Jan 2020 14:00:57 +0800</pubDate><description><![CDATA[文章目录引用和指针的区别汇编层次解释引用指针和引用函数调用的区别引用的好处
引用和指针的区别
（1）引用必须初始化，指针可以不初始化且可以为空
（2）引用不可更改其绑定对象，指针可以改变其指向对象
（3）sizeof对于引用得到是绑定对象的大小，而指针为4个字节（32位下）
（4）引用不是对象，指针是对象，所以不能定义引用的引用
（5）引用只能绑定在对象上，而不能绑定到字面值或某个表达式计算结果；...]]></description><category></category></item><item><title><![CDATA[C++11中的新容器(array，无序容器，tuple元组)]]></title><link>https://blog.csdn.net/songsong2017/article/details/103826560</link><guid>https://blog.csdn.net/songsong2017/article/details/103826560</guid><author>songsong2017</author><pubDate>Fri, 03 Jan 2020 20:18:39 +0800</pubDate><description><![CDATA[文章目录shrink_to_fitarrayforward_list无序容器元组tuple定义和初始化tuple访问tuple成员tuple中成员的数量和成员类型合并tuple遍历tupleC++11实现tuple的遍历C++14/17遍历参考资料
shrink_to_fit
// VS2019
int main() {
	vector&lt;int&gt; arr(100);
	arr.empl...]]></description><category></category></item><item><title><![CDATA[C++11中的function和bind]]></title><link>https://blog.csdn.net/songsong2017/article/details/103810309</link><guid>https://blog.csdn.net/songsong2017/article/details/103810309</guid><author>songsong2017</author><pubDate>Thu, 02 Jan 2020 20:04:49 +0800</pubDate><description><![CDATA[  C++11中引入lambda，与operator() 和 函数（函数指针）统称为可调用对象。而operator()和lambda也实现了闭包。
闭包的概念
  闭包是带有上下文的函数，这个函数带有状态，也就是重载了()的类。什么叫 “带有状态” 呢? 意思是这个闭包有属于自己的变量，这些个变量的值是创建闭包的时候设置的，并在调用闭包的时候，可以访问这些变量。
  函数是代码，状态是一组变量，将...]]></description><category></category></item><item><title><![CDATA[C++11-17中auto和decltype]]></title><link>https://blog.csdn.net/songsong2017/article/details/103737944</link><guid>https://blog.csdn.net/songsong2017/article/details/103737944</guid><author>songsong2017</author><pubDate>Fri, 27 Dec 2019 20:20:25 +0800</pubDate><description><![CDATA[文章目录autoC++11中auto的用法auto的注意点C++11中decltype的用法decltype的注意点C++14和17中的auto和decltype用auto声明函数返回值auto可用于lambda表达式的参数decltype(auto)声明函数返回类型用初始化值列表初始化变量auto的语义在if和switch中用auto参考资料
  用过matlab、python等语言会发现，刚开...]]></description><category></category></item><item><title><![CDATA[C++11中的列表初始化]]></title><link>https://blog.csdn.net/songsong2017/article/details/103715583</link><guid>https://blog.csdn.net/songsong2017/article/details/103715583</guid><author>songsong2017</author><pubDate>Thu, 26 Dec 2019 14:57:23 +0800</pubDate><description><![CDATA[文章目录统一初始化防止类型窄化initializer_list
统一初始化
  C++之前对内置数组可以都过花括号进行初始化，而对于vector数组、自定义类型无法通过花括号初始化。
// C++11之前的初始化
int a1[5] = {1, 2, 3};
int a2[] = {1, 2, 3};
int b(0);
int c1{0};   // c++98错误，C++11通过
int c2...]]></description><category></category></item><item><title><![CDATA[this指针和delete this]]></title><link>https://blog.csdn.net/songsong2017/article/details/103688757</link><guid>https://blog.csdn.net/songsong2017/article/details/103688757</guid><author>songsong2017</author><pubDate>Tue, 24 Dec 2019 19:46:30 +0800</pubDate><description><![CDATA[文章目录this指针的作用this指针是否可以为空delete this合法吗
this指针的作用
  this指针是指向类对象的指针，在类的成员函数中通过this指针这个隐式参数来访问调用它的对象。当我们调用一个成员函数时，编译器会把对象的地址传给成员函数的隐式形参this。this指针可以区分静态成员函数和外部函数（如静态函数），后者没有。
  为什么要引入this指针。由于每个对象都有其状态...]]></description><category></category></item><item><title><![CDATA[C++11-17中的lambda]]></title><link>https://blog.csdn.net/songsong2017/article/details/103648534</link><guid>https://blog.csdn.net/songsong2017/article/details/103648534</guid><author>songsong2017</author><pubDate>Sat, 21 Dec 2019 21:16:03 +0800</pubDate><description><![CDATA[文章目录可调用对象谓词lambda捕捉列表值捕获引用捕获可变lambda：mutable异常说明指定lambda返回类型lambda 捕捉表达式泛型lambdaconstexpr lambda向lambda传递this的拷贝参考资料
可调用对象
  可调用对象，有函数、函数指针、重载了函数调用运算符的类（也就是仿函数）、lambda表达式四种形式。这里主要介绍lambda的作用。
谓词
  先看下...]]></description><category></category></item><item><title><![CDATA[C++中的RTTI]]></title><link>https://blog.csdn.net/songsong2017/article/details/103604885</link><guid>https://blog.csdn.net/songsong2017/article/details/103604885</guid><author>songsong2017</author><pubDate>Wed, 18 Dec 2019 21:07:25 +0800</pubDate><description><![CDATA[  RTTI （Runtime Type Information，运行时类型信息），它提供了运行时确定对象类型的方法,程序能够使用基类的指针或引用来检查着这些指针或引用所指的对象的实际派生类型。为什么会出现RTTI这一机制，这和C++语言本身有关系。和很多其他语言一样，C++是一种静态类型语言。其数据类型是在编译期就确定的，不能在运行时更改。然而由于面向对象程序设计中多态性的要求，C++中的指针或...]]></description><category></category></item><item><title><![CDATA[编译器优化RVO和NRVO]]></title><link>https://blog.csdn.net/songsong2017/article/details/103580606</link><guid>https://blog.csdn.net/songsong2017/article/details/103580606</guid><author>songsong2017</author><pubDate>Tue, 17 Dec 2019 15:00:43 +0800</pubDate><description><![CDATA[编译器选择
  如果想自己实践RVO和NRVO，不要在VS下尝试（这里的VS不是指VS code），用支持g++的编译器去测试（我这里用的是minGW）。因为VS无论在Debug还是Release下都是无法关闭RVO优化的，Dubug下可以关闭NRVO优化。而g++默认都是执行NRV0优化的。
RVO/NRVO
  RVO(Return Value Optimization，返回值优化)，而NRV...]]></description><category></category></item><item><title><![CDATA[浅谈拷贝构造/赋值运算符函数]]></title><link>https://blog.csdn.net/songsong2017/article/details/103532543</link><guid>https://blog.csdn.net/songsong2017/article/details/103532543</guid><author>songsong2017</author><pubDate>Fri, 13 Dec 2019 19:51:11 +0800</pubDate><description><![CDATA[  拷贝构造函数和赋值运算符函数都是类中的特殊函数。什么时候执行拷贝构造函数/赋值运算符函数？拷贝初始化和直接初始化有什么区别？
拷贝构造函数
  如果一个构造函数的第一个参数是自身类类型的引用，且任何额外参数都有默认值，则此构造函数是拷贝构造函数。 如果第一个参数不是引用类型，为了调用拷贝构造函数，必须拷贝它的实参，但为了拷贝它的实参，有需要调用拷贝构造函数，如此无限循环。
拷贝赋值运算符
  ...]]></description><category></category></item><item><title><![CDATA[C++11中的nullptr和constexpr]]></title><link>https://blog.csdn.net/songsong2017/article/details/103528518</link><guid>https://blog.csdn.net/songsong2017/article/details/103528518</guid><author>songsong2017</author><pubDate>Fri, 13 Dec 2019 15:45:06 +0800</pubDate><description><![CDATA[nullptr
  nullptr的出现是为了代替NULL，首先看下NULL的定义：
// vs2017下
#ifndef NULL
    #ifdef __cplusplus
        #define NULL 0
    #else
        #define NULL ((void *)0)
    #endif
#endif

  C++将NULL视为0，所以以下代码就会影响直...]]></description><category></category></item><item><title><![CDATA[C++11中的override和final关键字]]></title><link>https://blog.csdn.net/songsong2017/article/details/103514202</link><guid>https://blog.csdn.net/songsong2017/article/details/103514202</guid><author>songsong2017</author><pubDate>Thu, 12 Dec 2019 18:27:24 +0800</pubDate><description><![CDATA[（1）override
  含义：被标识的函数需要强制重写基类虚函数。
class Base {
public:
	Base() = default;
	~Base() = default;
	virtual void test() {}
};

class Derived : public Base {
public:
	Derived() = default;
	~Derived() = de...]]></description><category></category></item><item><title><![CDATA[C++11中的default和delete]]></title><link>https://blog.csdn.net/songsong2017/article/details/103511395</link><guid>https://blog.csdn.net/songsong2017/article/details/103511395</guid><author>songsong2017</author><pubDate>Thu, 12 Dec 2019 16:28:34 +0800</pubDate><description><![CDATA[  C++一个类如果没有显式定义一些函数（如构造函数、析构函数、拷贝函数等），编译器在需要的时候会生成一个默认版本。C++11引入default和delete关键字，增强对类默认函数的控制，当让这不是全部功能。
（1）default
  含义：被标识的默认函数将使用类的默认行为。
class Test {
public:
	Test() = default;
	// Test(int x = 0)...]]></description><category></category></item><item><title><![CDATA[C中的volatile关键字]]></title><link>https://blog.csdn.net/songsong2017/article/details/103493782</link><guid>https://blog.csdn.net/songsong2017/article/details/103493782</guid><author>songsong2017</author><pubDate>Wed, 11 Dec 2019 15:44:10 +0800</pubDate><description><![CDATA[  volatile是C中的关键字，一般在嵌入式中用的比较多，其用来解决变量在“共享”环境下容易出现读取错误的问题。若变量被定义为volatile，则代表着该变量可能会被意想不到的改变，即在程序运行过程中一直变，这个值每次被处理时，都要从内存中读取该值，而不会因编译器优化从缓存的地方读取（比如说读取缓存在寄存器中的数值），从而保证volatile变量被正确读取。先看下面的代码：
int main(...]]></description><category></category></item><item><title><![CDATA[C/C++野指针]]></title><link>https://blog.csdn.net/songsong2017/article/details/103493689</link><guid>https://blog.csdn.net/songsong2017/article/details/103493689</guid><author>songsong2017</author><pubDate>Wed, 11 Dec 2019 15:42:27 +0800</pubDate><description><![CDATA[  野指针的定义：野指针不是nullptr，而是指向已经被释放的空间或者不可用的垃圾空间。常出现以下情形：
（1）指针未初始化就使用
int main() {
	int* p;
	if (p != nullptr)
		cout &lt;&lt; *p &lt;&lt; endl;
}
// 这段代码在VS2017下直接异常，提示p没有初始化
// 因为指针不像引用必须初始化，所以这个p是未定义的...]]></description><category></category></item><item><title><![CDATA[C++重载机制]]></title><link>https://blog.csdn.net/songsong2017/article/details/103493655</link><guid>https://blog.csdn.net/songsong2017/article/details/103493655</guid><author>songsong2017</author><pubDate>Wed, 11 Dec 2019 15:38:45 +0800</pubDate><description><![CDATA[参考：博客1， 博客2
  C++实现函数重载的技术手段是函数符号改名，所以我们可以通过分析编译器的函数符号改名机制来验证C++函数重载规则。
(1) 如何查看编译器改名后的函数名
  在VS编译器下，我们可以从符号表中看编译器如何改名的。符号表是在.map文件里，在vs里默认不显示符号表文件。要想显示出来，这样设置：属性—&gt;配置属性—&gt;链接器—–&gt;调试—&gt;生成映射文件—&...]]></description><category></category></item><item><title><![CDATA[572.另一个树的子树]]></title><link>https://blog.csdn.net/songsong2017/article/details/103362538</link><guid>https://blog.csdn.net/songsong2017/article/details/103362538</guid><author>songsong2017</author><pubDate>Tue, 03 Dec 2019 10:28:35 +0800</pubDate><description><![CDATA[题目描述

给定两个非空二叉树 s 和 t，检验 s 中是否包含和 t 具有相同结构和节点值的子树。s 的一个子树包括 s 的一个节点和这个节点的所有子孙。s 也可以看做它自身的一棵子树。



示例


示例 1:
给定的树 s:

 3
 / \
 4 5
 / \
1 2

给定的树 t：

 4
 / \
1 2

返回 true，因为 t 与 ...]]></description><category></category></item></channel></rss>