Skip to content

关于本章

本章讨论C++17引入的**Common vocabulary types**。

What is vocabulary type?

"vocabulary" 的意思是 "词汇",那"vocabulary type"的含义是什么呢?

packtpub Chapter 5. Vocabulary Types

A "vocabulary" type is a type that purports to provide a single lingua franca, a common language, for dealing with its domain.

“词汇表”类型声称提供一种单一的*通用语*,一种通用语言,用于处理其域。

stackoverflow What are “vocabulary types”, and how many exist?

Across programming languages, I've encountered similar composite types with different names:

  1. Optional / Maybe
  2. Any
  3. Variant / Sum
  4. Record / Product

People often use the term vocabulary type, yet I've never seen a definition of what makes a type "vocabulary".

foonathan What should be part of the C++ standard library? # 2. Vocabulary types and concepts

How To Use Vocabulary Types from C++17?

bfilipek How To Use Vocabulary Types from C++17, Presentation

C++ VS C

std::any type erasure,是对void *的增强。

std::variantunion的增强。