11 2020 档案

摘要:Version 0.01:使用 linux API (epoll) 实现一个 echo toy. UNIX 网络编程基础介绍: 个人认为,网络编程的本质还是进程间通信,只是通信区域跨越了一个网络罢了,通信的方式是使用套接字。 重要的数据结构: struct sockaddr_in{ short in 阅读全文
posted @ 2020-11-27 12:06 Codroc 阅读(134) 评论(0) 推荐(0) 编辑
摘要:socket 概述 在一个典型的 C\S 场景中,应用程序使用 socket 进行通信的方式如下: 各个应用程序创建一个 socket。socket 是一个允许通信的“设备”,两个应用程序都需要用到它 服务器将自己的 socket 绑定到一个众所周知的地址上使得客户端能够定位到它的位置 通信 dom 阅读全文
posted @ 2020-11-26 14:10 Codroc 阅读(411) 评论(0) 推荐(0) 编辑
摘要:Alias(化名) Tempalte (template typedef) template <typename T> using Vec = std::vector<T, MyAlloc<T>>; the term vec<int> coll; is equivalent to std::vect 阅读全文
posted @ 2020-11-20 15:46 Codroc 阅读(172) 评论(0) 推荐(0) 编辑
摘要:decltype (declare type) decltype 相当于 typeof。 可以用来申明一个返回类型 template<typename T1, typename T2> decltype(x+y) add(T1 x, T2 y); 使用 decltype 可以使得编译器找到表达式的类 阅读全文
posted @ 2020-11-20 15:28 Codroc 阅读(350) 评论(0) 推荐(0) 编辑
摘要:lambdas 类似于一种 inline function,能被当作是一种参数或是一种局部对象。 看到中括号开头的那就是 lambda 啦~~~ [] { std::cout << "hello lambda!" << std::endl; }; [] { std::cout << "hello l 阅读全文
posted @ 2020-11-19 16:26 Codroc 阅读(80) 评论(0) 推荐(0) 编辑
摘要:红色 绿色 蓝色 Initializer List An initializer list forces so-called value initialization, which means that even local variables of fundamental types, which 阅读全文
posted @ 2020-11-19 16:17 Codroc 阅读(172) 评论(0) 推荐(0) 编辑
摘要:explicit for ctors taking more than one argument struct Complex{ double _real; double _i; Complex(double real, double i = 0) : _real(real), _i(i){} // 阅读全文
posted @ 2020-11-19 16:00 Codroc 阅读(107) 评论(0) 推荐(0) 编辑
摘要:Rvalue references (右值引用) and Move Semantics Rvalue references are a new reference type introduced in C++0x that help solve the problem of unnecessary 阅读全文
posted @ 2020-11-19 15:31 Codroc 阅读(108) 评论(0) 推荐(0) 编辑
摘要:range-based for statement for(decl : coll){ // decl:声明 coll:容器 statement } for(int i : {2, 3, 4, 5, 6}){ cout << i << endl; } vector<double> vec; ··· 阅读全文
posted @ 2020-11-19 11:50 Codroc 阅读(89) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-11-19 11:29 Codroc 阅读(78) 评论(0) 推荐(0) 编辑
摘要:Type Alias (similar to typedef) // typedef void (*func)(int, int) using func = void (*) (int, int); // the name 'func' now denotes a pointer to functi 阅读全文
posted @ 2020-11-18 21:08 Codroc 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Variadic Template 谈的是 template function template class template 变化的是 template parameters 参数个数 (variadic number) 利用参数个数逐一递减的特性,实现递归函数调用,使用 function tem 阅读全文
posted @ 2020-11-18 21:05 Codroc 阅读(147) 评论(0) 推荐(0) 编辑
摘要:=default, =delete 如果你自行定义一个 ctor,那么编译器就不会再给你一个 default ctor(包括了构造函数,拷贝构造函数,拷贝赋值函数)。 如果你强制加上了 =default,就可以重新获得并使用 default ctor。 Big Three 就是所谓的: 构造函数 拷 阅读全文
posted @ 2020-11-18 10:27 Codroc 阅读(115) 评论(0) 推荐(0) 编辑
摘要:译者记 为什么函数模版的全特化是不参与函数重载的呢?而为什么函数模版没有偏特化概念呢?其实是C++语法规定的,但是在平时的工作过程中,出现过因为函数版本不能偏特化困扰我们的工作吗?答案是没有,也许很多人忽略了这个问题,主要是因为可以通过函数重载来规避这个问题(或者可以认为这不是一个问题)。 另,在《 阅读全文
posted @ 2020-11-05 16:06 Codroc 阅读(891) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示