Lv.的博客

随笔分类 -  C++11

该文被密码保护。
posted @ 2015-05-09 16:54 Avatarx 编辑
该文被密码保护。
posted @ 2015-05-09 15:48 Avatarx 编辑
该文被密码保护。
posted @ 2015-05-09 15:35 Avatarx 编辑
该文被密码保护。
posted @ 2015-05-09 15:25 Avatarx 编辑
该文被密码保护。
posted @ 2015-05-09 15:22 Avatarx 编辑
摘要:C++11中增加了final与override关键字,貌似是从Java语言中借鉴而来,用途也一样。看例子代码:01.#include 02.03.usingnamespacestd;04.05./* use final on a class to prevent inheriting; compil... 阅读全文
posted @ 2015-05-09 15:20 Avatarx 编辑
摘要:Introduction:Before the possibilities of the newC++ language standard,C++11, the use oftemplateswas quite limited when it came to implementing for ins... 阅读全文
posted @ 2015-05-09 15:11 Avatarx 编辑
摘要:Variadic macros are function-like macros that contain a variable number of arguments.RemarksTo use variadic macros, the ellipsis may be specified as t... 阅读全文
posted @ 2015-05-09 15:03 Avatarx 编辑
摘要:In N2402, Anthony Williams proposes that local types, and unnamed types be usable as template arguments. At the February 2008 (Bellevue) meeting, the ... 阅读全文
posted @ 2015-05-09 14:53 Avatarx 编辑
摘要:Templates can be defined within classes or class templates, in which case they are referred to as member templates. Member templates that are classes ... 阅读全文
posted @ 2015-05-09 14:49 Avatarx 编辑
摘要:在C++98/03语言标准中,对于源代码中出现的每一处模板实例化,编译器都需要去做实例化的工作;而在链接时,链接器还需要移除重复的实例化代码。显然,让编译器每次都去进行重复的实例化工作显然是不必要的,并且连接器也因此受累。在现实编码世界里,一个软件的实现可能会在很多代码块中使用同一种类型去实例化同一... 阅读全文
posted @ 2015-05-09 14:41 Avatarx 编辑
摘要:static_assert提供一个编译时的断言检查。如果断言为真,什么也不会发生。如果断言为假,编译器会打印一个特殊的错误信息。12345678910111213template class Vector{static_assert(Size a1;Vector a2;return 0;}1234... 阅读全文
posted @ 2015-05-09 14:39 Avatarx 编辑
摘要:In C++03, the return type of a function template cannot be generalized if the return type relies on those of the template arguments. Here is an exampl... 阅读全文
posted @ 2015-05-09 14:30 Avatarx 编辑
摘要:0. 形式for ( declaration : expression ) statement0.1 根据标准将会扩展成这样的形式:1 {2 auto&& __range = expression;3 for (auto __begin = begin-expression,4 __end = en... 阅读全文
posted @ 2015-05-09 14:10 Avatarx 编辑
摘要:简介C++0x中引入了static_assert这个关键字,用来做编译期间的断言,因此叫做静态断言。其语法很简单:static_assert(常量表达式,提示字符串)。如果第一个参数常量表达式的值为真(true或者非零值),那么static_assert不做任何事情,就像它不存在一样,否则会产生一条... 阅读全文
posted @ 2015-05-09 14:04 Avatarx 编辑
摘要:C的NULL在C语言中,我们使用NULL表示空指针,也就是我们可以写如下代码:int*i=NULL;foo_t*f=NULL;实际上在C语言中,NULL通常被定义为如下:#defineNULL((void*)0)也就是说NULL实际上是一个void *的指针,然后吧void *指针赋值给int *和... 阅读全文
posted @ 2015-05-09 13:55 Avatarx 编辑
摘要:C++11 新增了很多特性,lambda 表达式是其中之一,如果你想了解的 C++11 完整特性,建议去这里,这里,这里,还有这里看看。本文作为 5 月的最后一篇博客,将介绍 C++11 的 lambda 表达式。很多语言都提供了 lambda 表达式,如 Python,Java 8。lambda ... 阅读全文
posted @ 2015-05-09 13:47 Avatarx 编辑
摘要:原型:#include forward_iterator remove_if(forward_iterator start,forward_iterator end,Predicate p);函数remove_if()移除序列[start, end)中所有应用于谓词p返回true的元素.此函数返回一... 阅读全文
posted @ 2015-05-09 13:43 Avatarx 编辑
摘要:一. move关于 lvaue 和 rvalue,在 c++11 以前存在一个有趣的现象:T& 指向 lvalue (左传引用), const T& 既可以指向 lvalue 也可以指向 rvalue。但却没有一种引用类型,可以限制为只指向 rvalue。这乍看起来好像也不是很大的问题,但其实不是这... 阅读全文
posted @ 2015-05-09 13:23 Avatarx 编辑
摘要:在C++中,decltype作为操作符,用于查询表达式的数据类型。decltype在C++11标准制定时引入,主要是为泛型编程而设计,以解决泛型编程中,由于有些类型由模板参数决定,而难以(甚至不可能)表示之的问题。泛型编程在整个1990年代越发流行,对实现类型推导机制的需求也应运而生。为此,许多编译... 阅读全文
posted @ 2015-05-09 12:53 Avatarx 编辑

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