Overview of C++23 Features
新年伊始,要说什么选题最合适,那无疑是 C++23 了。 去年只写过 Ranges 和几个小特性的提案,对于其他特性,就全放在此篇一览究竟。 23 是个小版本,主要在于「完善」二字,而非「新增」。因此… Continue Reading Overview of C++23 Features
Dive deep into the C++ core, and discover more!
新年伊始,要说什么选题最合适,那无疑是 C++23 了。 去年只写过 Ranges 和几个小特性的提案,对于其他特性,就全放在此篇一览究竟。 23 是个小版本,主要在于「完善」二字,而非「新增」。因此… Continue Reading Overview of C++23 Features
占位,待录
占位,待录。
占位,待录。
import std; auto main() -> int { std::println("Hello world!"); } 随着 Modules 和 Formattin… Continue Reading “Hello World” in C++23
设计程序,经常需要分离不变的和变化的逻辑。将不变的逻辑放到一块,再以某种形式为变化的部分提供「定制点」,从而使程序具有更好的可扩展性,同时增加相似逻辑的可复用性。 因此,本质上来说,设计是为了应对变化… Continue Reading 使用Concepts表示变化「定制点」
占位,待录。
占位,待录。
最近发现泛型编程有了另一利器——泛型 Lambda,比想象当中要强大许多,威力不小,和大家分享一下。 本篇内容需要对泛型编程有所了解,若是读过之前更新的相关文章,食用更佳。 泛型编程 开始之前,先来简… Continue Reading 泛型 Lambda,如此强大!
根据提案 P0634-Down with typename,C++20 之后 typename 在有些地方不再必要。 原文主要内容如下: If X::Y — where T is a template… Continue Reading 新简化!typename 在 C++20 不再必要
介绍 今天这篇文章,我想跟大家探索下 Attributes 这个概念。 如果你还没有听过这个概念,或是一知半解,没咋用过,那正好表明它处于一个被忽略或是低估的位置。 Meeting C++ 曾经对此做… Continue Reading 那些值得使用的 C++ Attributes
C++20 新增了两个 const 相关的关键字,于是当前存在四个相似的关键字:const,constexpr,consteval 和 constinit。 接下来分别来进行讨论。 第一,经过 con… Continue Reading Differences between keywords constexpr, consteval and constinit
Introduction 程序设计需要不断地做抉择,抉择便需用到逻辑分派。 Modern C++ 中,有多种方式完成这个任务,例如 Run-time if,Tag dispatching,SFINAE… Continue Reading Simplify Code with “if constexpr” in C++17
本篇作为 Understanding variadic templates 的进阶内容,同时,Fold Expressions 也是 C++17 最常用的特性之一。 Fold Expressions … Continue Reading C++17: Simplify Code with Fold Expressions