博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C++ Primer Plus学习笔记 第十八章 C++11新标准
阅读量:4126 次
发布时间:2019-05-25

本文共 959 字,大约阅读时间需要 3 分钟。

新增 long long 和 unsigned long long char16_t char32_t string

新增初始化列表{1, 2, 3, 4}   对象初始化也能这么用除了有奖std::initializer_list作为参数的构造函数。那么只有该构造函数可以使用列表初始化

列表初始化 禁止类型缩窄,但允许加宽

std:initializer_list

auto 关键字 类型自动推断

decltype  定义声明的类型与表达式指定的类型一致 

参考第八章  嗯。。第八章有么?

返回类型后置

auto f2 (double, int) -> double

这个可以跟decltype结合起来使用‘’

模板别名using =

类似typedef

但是可用于模板具体化

nullptr 空指针 代表-0

智能指针   unique_ptr, shared_ptr weak_ptr 16章详细

枚举 看第十章

explicit 要求显式数据类型转换

右值

使用&&描述

#include
inline double f(double tf) {return 5.0*(tf - 32.0) / 9.0;}int main(){ using namespace std; double tc = 21.5; double && rd1 = 7.07; double && rd2 = 1.8 * tc + 32.0; double && rd3 = f(rd2); cout << "tc value and address: " << tc << ", " << &tc << endl; cout << "rd1 value and address: " << rd1 << ", " << &rd1 << endl; cout << "rd2 value and address: " << rd2 << ", " << &rd2 << endl; cout << "rd3 value and address: " << rd3 << ", " << &rd3 << endl; cin.get(); return 0;}

右值的主要目的之一是实现移动语义 下一节讨论

转载地址:http://xsepi.baihongyu.com/

你可能感兴趣的文章
北京十大情人分手圣地
查看>>
Android自动关机代码
查看>>
Android中启动其他Activity并返回结果
查看>>
2009年33所高校被暂停或被限制招生
查看>>
GlassFish 部署及应用入门
查看>>
iWatch报错: Authorization request cancled
查看>>
iWatch报错: Authorizationsession time out
查看>>
如何运行从网上下载的iWatch项目详细步骤.
查看>>
X-code7 beta error: warning: Is a directory
查看>>
Error: An App ID with identifier "*****" is not avaliable. Please enter a different string.
查看>>
X-code beta 开发iWatch项目,运行没有错误,但是某些操作一点就崩,而且找不错误的原因场景一
查看>>
Xcode 报错: Extra argument in call
查看>>
iTunes Connect 上传APP报错: Communication error. please use diagnostic mode to check connectivity.
查看>>
#import <Cocoa/Cocoa.h> 报错 Lexical or Preprocessor Issue 'Cocoa/Cocoa.h' file not found
查看>>
`MQTTClient (~> 0.2.6)` required by `Podfile`
查看>>
X-Code 报错 ld: library not found for -lAFNetworking
查看>>
Bitcode
查看>>
If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
查看>>
3.5 YOLO9000: Better,Faster,Stronger(YOLO9000:更好,更快,更强)
查看>>
iOS菜鸟学习--如何避免两个按钮同时响应
查看>>