
http://blog.****.net/cnsword/article/details/8034947
公司可以使用c++11.看大牛的代码模仿使用,所以现在已经不知道什么使用的是c++的语法还是c++11的语法了...不知道算不算是一种悲哀
C++11对关键字进行了修订,加入了nullptr、constexpr、decltype、default、static_assert等,同时原有的关键字(auto,using,extern)含义和用途进行了修订。在这里主要了解一下对auto、using、extern这三个关键字的修订。
auto :
/*自动化变量*/
auto a = ;
auto b = 12.0f;
auto c = "abc"
auto d = [] (int x)->int{return ;} //参见c++文章<c++lambda表达式>
auto e = std::bind(&func, _1);//参见c++文章<std::function和std::bind函数指针> vector<int> s;
s.push_back();
s.push_back();
for (auto it = s.begin(); it != s.end(); it++)
{
cout<<*it<<endl;
} /*延迟绑定*/ //参见文章 <c++11的decltype>
template<typename T, typename L>
auto fun( T x, L y)->decltype(x + y){return x;}
using :
/*定义别名*/
template<class T>
using Tlist = std::list<T>; using Tlist = std::list<char>;
Tlist listChar; //typedef void (*df)()
using df = void(*)(); /*使用外部构造*/
using A::A; /*引用外部类型*/
using typename A;
extern
/*外部模板*/
extern template<class T>void(T t);