c++新特性-收缩转换,二进制,constexpr,以及namespace&&inline

char(112312312);//不会检查是否超过范围,会截断

char{12345435345};//会报异常,异常如下:

error C2397: 从“__int64”转换到“char”需要收缩转换

warning C4305: “初始化”: 从“__int64”到“char”截断

warning C4309: “初始化”: 截断常量值

c++14二进制支持(0b) 即int a=0b1001;//9,0B1101(13)

constexpr标志返回值或其他表达式是常量,用于返回常量可以用于需要常量表达式的等数组中

constexpr int get()

{

  return 100;

}

int a[10+get()];//可以

inline 在命名空间新特性:namespace&& inline

#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <numeric>
#include <array>
#include <cstring>
#include <cstdio>
using namespace  std;
namespace all{
    namespace V2017
    {
        void fun(int num){ cout << "int V2017" << endl; }

    }
}
namespace all {
    //展开在all,默认调用
    inline namespace V2018
    {
        void fun(int num){ cout << "int V2018" << endl; }
        void fun(double num){ cout << "double V2018" << endl; }

    }
}
int main()
{
    all::V2017::fun(12);//明确调用
    all::V2018::fun(16);
    all:fun(1);//默认调用
    system("pause");

}