C++标准库第二版笔记 2.1
C++标准库第二版笔记 2.1
1 Range-Based for 循环
for ( decl : coll ) {
statements;
}
// collaborate
类似C# foreach?
2 新式的字符串字面常量(String Literal)
常用于正则表达式(regular expression)
R"(\\n)"
// 相当于
R"\\\\n"
当你想在字符串中写出一个右括号“)”,则使用定义符(delimiter) 换而言之,如果你想在字符串中添加括号,使用定义符。
R"NC(any stuff NC())NC"
// Equals
"any stuff NC()"
2.1 编码的(encoded)string literal
L"" // wide string literal "wchar_t"
U"" // string literal char32_t
u"" // string literal char16_t
u8"" // UTF-8 const char
16章介绍如何使用不同的编码(encoding)完成国际化(internationalization)
3 关键字 noexcept
异常是一个尚未能理解的大话题,另起一篇文章详细讨论异常。
4 崭新的 template 特性
模版是一个尚未能理解的大话题,另起一篇文章详细讨论模版。
5 lambda 表达式
同上
6 关键字 decltype
decltype(declared type)
是一个可以让编译器找出表达式类型的关键字。
std::map<std::string, float> coll;
decltype(coll)::value_type elem;
应用之一是声明返回类型,另一个用途是metaprogramming(超编程;元编程)或是用来传输一个lambda类型。
7 新的函数声明语法(New Function Declaration Syntax)
template<typename T1, typename T2>
auto add(T1 x, T2 y) -> decltype(x+y)
// Equals Pseudocode decltype(x+y) add(T1 x, T2 y)
这种写法和“为lambda声明返回类型”是一样的。
8 带领域的(scoped)枚举常量(enumeration)
又称strong enumeration或enumeration class,这是enumeration value(或称为enumerator)的一个较干净的实现。
enum class Salutation : char { mr, ms, co, none };
好处: 1、绝不会隐式自、至int 2、如果数值不再enumeration被声明的作用域内,你必须改写为salutation::mr 3、通过定义一个底层类型来确保每一个值的大小。 4、有提前声明(forward declaration)可供使用,以避免新的值而重新编译。
type trait std::underlying_type 你可以核定(evaluate)一个枚举类型。
error condition value也是一个scoped enumerator???
C++标准库第二版笔记 2.1的更多相关文章
- C++标准库第二版笔记 3 和异常的理解 1
C++标准库第二版笔记 3 和异常的理解 1 差错和异常(error and exception)的处理 标准异常类(exception class) 定义于 分为: 1.语言本身支持的异常 2.标准 ...
- C++标准库第二版笔记 2
C++标准库第二版笔记 2 微小但重要的语法提升 template表达式内的空格: vector< list<int> >; // OK in each C++ version ...
- C++标准库第二版笔记 1
C++标准库第二版笔记 1 C++ std历史 第一份标准化文档: C++98 & C++03 & TR1 TR1 Information Technology- Programmin ...
- python核心编程第二版笔记
python核心编程第二版笔记由网友提供:open168 python核心编程--笔记(很详细,建议收藏) 解释器options:1.1 –d 提供调试输出1.2 –O 生成优化的字节码(生成 ...
- 《C标准库》学习笔记整理
简介 <C标准库>书中对 C 标准库中的 15 个头文件的内容进行了详细的介绍,包括各头文件设计的背景知识.头文件中的内容.头文件中定义的函数和变量的使用.实现.测试等. 我学习此书的目的 ...
- Python高级编程第二版--笔记
不只是CPython Stackless Python Jython(与java集成) IronPython(与net集成) PyPy python真正出众的领域在于围绕语言打造的整个生态系统. Py ...
- 《C++ 标准库》读书笔记 - 第二章 Introduction to C++ and the Standard Library
1. History of the C++ Standards 1.1 History of the C++ Standards C++98 -> C++03 -> TR1 -> C ...
- JavaPersistenceWithHibernate第二版笔记-第四章-Mapping persistent classes-003映射实体时的可选操作(<delimited-identifiers/>、PhysicalNamingStrategy、PhysicalNamingStrategyStandardImpl、、、)
一.自定义映射的表名 1. @Entity @Table(name = "USERS") public class User implements Serializable { / ...
- JavaPersistenceWithHibernate第二版笔记-第四章-Mapping persistent classes-002identity详解
一.简介 1.You now have three methods for distinguishing references: Objects are identical if they occ ...
随机推荐
- SQL SERVER 死锁
sp_lock 查看锁表名称 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableNamefr ...
- as3 加载进来的swf进行缩放
private function swfComHdl(_loader:Loader, _data:*= null){ frameLder = _loader; gameMC = frameLder.c ...
- Golang源码探索(二) 协程的实现原理(转)
Golang最大的特色可以说是协程(goroutine)了, 协程让本来很复杂的异步编程变得简单, 让程序员不再需要面对回调地狱,虽然现在引入了协程的语言越来越多, 但go中的协程仍然是实现的是最彻底 ...
- Zabbix客户端日志出现(Not all processes could be identified, 解决
场景:因为使用了netstat -p参数. 权限问题,zabbix_agentd是zabbix用户启动的,默认不能执行netstat -p等命令,导致从服务器取到的自动发现脚本为空 (Not all ...
- lnmp环境部署脚本-y
系统环境:centos6.X #!/bin/bash#date:2018-01-01## MySQL 安装8版本的话不太适合,有待于添加安装脚本进行测试#新版的MySQL安装需要高版本2.8以上cma ...
- Oracle 批量修改字段长度
Oracle 批量修改字段长度 SELECT 'alter table '||a.table_name||' MODIFY '||A.COLUMN_NAME||' VARCHAR2(100);' ...
- 【C++】纯C++实现http打开网页下载内容的功能
#include "stdafx.h" #include <windows.h> #include <iostream> #include "Wi ...
- Day07 - Ruby比一比:Symbol符号与String字串
前情提要: 第六天我们透过Ruby代码练习public,protected和privatemethod时,发现冒号在前面的参数,:mydraft,:myspace,这些就是符号Symbol.在今天,我 ...
- Presto集群部署和配置
参考文档:1.https://blog.csdn.net/zzq900503/article/details/79403949 prosto部署与连接hive使用 2. ...
- Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)
不管是啥都响应tableviewcell class JYShopCertificationCell: UITableViewCell { override func hitTest(_ point: ...