随笔分类 - c++11&14
摘要:Alias(化名) Tempalte (template typedef) template <typename T> using Vec = std::vector<T, MyAlloc<T>>; the term vec<int> coll; is equivalent to std::vect
        阅读全文
                
摘要:decltype (declare type) decltype 相当于 typeof。 可以用来申明一个返回类型 template<typename T1, typename T2> decltype(x+y) add(T1 x, T2 y); 使用 decltype 可以使得编译器找到表达式的类
        阅读全文
                
摘要:lambdas 类似于一种 inline function,能被当作是一种参数或是一种局部对象。 看到中括号开头的那就是 lambda 啦~~~ [] { std::cout << "hello lambda!" << std::endl; }; [] { std::cout << "hello l
        阅读全文
                
摘要:红色 绿色 蓝色 Initializer List An initializer list forces so-called value initialization, which means that even local variables of fundamental types, which
        阅读全文
                
摘要:explicit for ctors taking more than one argument struct Complex{ double _real; double _i; Complex(double real, double i = 0) : _real(real), _i(i){} //
        阅读全文
                
摘要:Rvalue references (右值引用) and Move Semantics Rvalue references are a new reference type introduced in C++0x that help solve the problem of unnecessary 
        阅读全文
                
摘要:range-based for statement for(decl : coll){ // decl:声明 coll:容器 statement } for(int i : {2, 3, 4, 5, 6}){ cout << i << endl; } vector<double> vec; ··· 
        阅读全文
                
摘要:Automatic Type Deduction with auto With C++11, you can declare a variable or an object without specifying its type by using auto. For example: auto i 
        阅读全文
                
摘要:Type Alias (similar to typedef) // typedef void (*func)(int, int) using func = void (*) (int, int); // the name 'func' now denotes a pointer to functi
        阅读全文
                
摘要:Variadic Template 谈的是 template function template class template 变化的是 template parameters 参数个数 (variadic number) 利用参数个数逐一递减的特性,实现递归函数调用,使用 function tem
        阅读全文
                
摘要:=default, =delete 如果你自行定义一个 ctor,那么编译器就不会再给你一个 default ctor(包括了构造函数,拷贝构造函数,拷贝赋值函数)。 如果你强制加上了 =default,就可以重新获得并使用 default ctor。 Big Three 就是所谓的: 构造函数 拷
        阅读全文
                
                    
                
浙公网安备 33010602011771号