1.带有检测机制的标准库(first是否在与last之前)

#include <iostream>
#include <iterator>
template <class InputIt,typename Value>
InputIt find(InputIt T_first,InputIt T_last,const Value& T_value)
{
      typename std::iterator_traits<InputIt>::difference_type len= std::distance(T_first,T_last);
      //auto len= std::distance(T_first,T_last);
       if (len<= 0)
          return T_last;
       while(len> 0)
       {
             if (T_value== *T_first)
                return T_first;
            ++T_first;
            --len;
       }   
       return T_last;
}
int main()
{
    char ch[]={'a','b','c','d','e','f'};
    auto p= find(std::begin(ch),std::end(ch),'h');
    if (p== std::end(ch))
    {
        std::cout<<"no find\n";
        return 0;
    }
    std::cout<<"find "<<*p<<"\n";
    return 0;
}

2.c++中并不允许对内部类型的临时变量进行修改

3.模板构造函数并不能代替构造函数,其将与其他构造函数一起共同参与重载解析

4.通过异常退出构造函数意味着对象实际从来没有被构造为一个完整对象,即这个对象生命周期没有开始过

5.析构函数、重载operator delete[]或内存释放函数声明为noexcept

6.将可能发生异常的代码单独放在一起并对其进行安全处理,之后才可以使用不会抛出异常的操作来修改(或清理)

7.异常安全(在出现异常的情况下仍然能够正确运行);异常中立(将所有的异常都转发给调用者,而不会在对象中产生完整性问题)

8.应努力使每个模块、每个类、每个函数都只有单一的并且是明确定义的功能(内聚性)

9.new object,operator new(SIZE) 前一个有初始化objcet,即自由存储中将包含被默认构造号的一个object对象。

10.基本保证就是用来保证可析构性和没有资源泄漏;强保证则增加了对commit-or-rollback语义的保证;无异常抛出保证则用来保证在函数中不会抛出异常

11.the delete operator and operator delete() are not the same thing.

delete some_pointer:call the destructor of the object pointed to by some_pointer,and then calls operator delete() to free the memory;

12.对外层作用域(基类、外部类或者名字空间)中的函数f()进行隐藏式表示在内层作用域(派生类、嵌套类或者嵌套名字空间)中定义为一个相同名字f()

的函数,这将隐藏外层作用域中的相同名字的函数

13.名字隐藏:派生类函数会自动地隐藏所有在直接基类和间接基类中名字相同的函数

14.基类*p= new 派生类[size];

delete[] p;

永远都不要通过多态的方式来处理数组