constexpr:修饰常量表达式,约定修饰对象不仅为常量,而且在编译阶段就能得到值. 与const不同的是,constexpr约束的是当事人,就是说,constexpr int *a=1;这样的语句,a指针本身是const,并且右边也足够简单,而const int*a:这样的语句,则约定了a指向对象是const,这是不同点.constexpr直接限定为顶层const. 类型别名:传统的是typedef, typedef double a; a b = 1.1; 类似这样的代码么就是说a是一个d
Scott Meyers在effective modern c++中提到“If there were an award for the most confusing new word in C++11, constexpr would probably win it.” 由此可见,constexpr确实是比较难以让人理解.加之其在C++11和14中的标准略有不同,也加剧了这种难度. 参考几本经典教材(C++ primer, effective modern C++, a tour of C++)
google的protobuf是一种轻便高效的结构化数据存储格式,在通信协议和数据存储等领域中使用比较多.protobuf对于结构中的每个成员,会提供set系列函数和get系列函数. 但是,对于使用来说,需要根据传入的参数考虑需要调用的函数名,在使用这个比较多的情况,还是会让人觉得有些麻烦.而且,对于有些使用,例如之后打算不再使用protobuf,改为直接将数据压入内存段(The raw in-memory data structures sent/saved in binary form),或
C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very early draft. It is inkorrekt, incompleat, and pµøoorly formatted. Had it been an open source (code) project, this would have been release 0.6. Copy
Apr 13, 2017 Stop me if you’ve heard this one before. You are working on a messaging middleware, a game engine, a UI library, or any other large software project that has to deal with an ever-growing, ever-changing number of objects. These objects ha
C++17/14/11 Overview Many of these descriptions and examples come from various resources (see Acknowledgements section), summarized in my own words. Also, there are now dedicated readme pages for each major C++ version. C++17 includes the following n
翻译自https://www.bfilipek.com/2019/02/lambdas-story-part1.html与https://www.bfilipek.com/2019/02/lambdas-story-part2.html. C++ lambda的演化 C++ Lambda Story The evolution of a powerful modern C++ feature: From C++03 to C++20 目录 前言 反馈 关于作者 译者的话 1. C++0