Concepts
来自cppreference.com
< cpp
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
的概念是一个术语,用于描述一个命名的一组要求'一类。概念是一个更便捷的途径,同时指定什么样的属性,预计从类型,类型具有什么样的属性.
原文:
A concept is a term that describes a named set of requirements for a type. Concepts are a more convenient way to specify both what properties are expected from a type, and what properties a type has.
有a proposal的概念转化为一个正式的规范,包括C + +11,这样编译器可以检查类型的要求“前”模板实例化,进而产生更合理的错误消息的情况下,类型不履行的模板的要求。由于种种原因后来放弃了这个建议。不过,也有非官方的计划,以增加将来的修订版的C + +语言的概念.
原文:
There was a proposal to include a formal specification of concepts into C++11 so that the compiler could check the type requirements before template instantiation and in turn could produce much more sensible error messages in case a type did not fulfill the template requirements. This proposal was later dropped for various reasons. However, there are unofficial plans to add concepts to a future revision of the C++ language.
这里的“概念”有一点共同的上述建议。他们指的非正式命名的要求,在C + +03和C + +11定义不同类型的行为和预期的性能.
原文:
Here concepts have little in common with the abovementioned proposal. They refer to informal named requirements, used in C++03 and C++11 to define behavior and expected properties for various types.
| |
指定类型具有默认的构造函数 原文: specifies that type has default constructor (概念) | |
(C++11) |
指定该类型的移动构造函数 原文: specifies that type has move constructor (概念) |
指定该类型的拷贝构造函数 原文: specifies that type has copy constructor (概念) | |
(C++11) |
指定类型有移动赋值运算符 原文: specifies that type has move assignment operator (概念) |
指定该类型的拷贝赋值运算符 原文: specifies that type has copy assignment operator (概念) | |
类型有一个析构函数,清除所有的内存 原文: type has a destructor that clears all memory (概念) | |
| |
Note, that the standard doesn't define named requirements or concepts with names specified in this subcategory. These are type categories defined by the core language. They are included here as concepts only for consistency. | |
(C++11) |
类琐碎的复制,转让和析构函数 原文: class with trivial copy, assignment and destructor (概念) |
(C++11) |
类琐碎的构造函数,赋值和析构函数 原文: class with trivial constructors, assignment and destructor (概念) |
(C++11) |
非虚拟类只包含其他StandardLayout的成员,都具有相同的访问控制 原文: non-virtual class containing only other StandardLayout members, all with the same access control (概念) |
POD(普通旧数据)结构,与Cstruct兼容 原文: POD (Plain Old Data) structure, compatible with C struct (概念) | |
| |
有一个工作 operator== 是一个等价关系原文: has a working operator== that is an equivalence relation(概念) | |
operator< 是一个严格弱序关系原文: operator< is a strict weak ordering relation(概念) | |
(C++11) |
可以调换不合格的非成员函数调用swap() 原文: can be swapped with an unqualified non-member function call swap() (概念) |
(C++11) |
(概念) |
(C++11) |
类似指针的类型支持空值 原文: pointer-like type supporting a null value (概念) |
(C++11) |
(概念) |
类类型,它包含配置信息 原文: class type that contains allocation information (概念) | |
一个函数对象,可以调用与具体的参数和返回值转换成特定类型 原文: a function object that can be called with specific arguments and has return value convertible to specific type (概念) | |
一个 Callable 返回一个值转换为一个参数,而无需修改bool原文: a Callable that returns a value convertible to bool for one argument without modifying it(概念) | |
一个 Callable ,返回一个值转换为bool两个参数,而无需修改原文: a Callable that returns a value convertible to bool for two arguments without modifying them(概念) |
| |
数据结构元素的访问,允许使用迭代器 原文: data structure that allows element access using iterators (概念) | |
使用双向迭代器的容器 原文: container using bidirectional iterators (概念) | |
(C++11) |
容器使用的分配器 (概念) |
容器的元素以线性方式存放 原文: container with elements stored linearly (概念) | |
容器,其存储通过关联他们键的元素 原文: container that stores elements by associating them to keys (概念) | |
容器,用于存储元素的存储桶的关联键 原文: container that stores elements stored in buckets by associating them to keys (概念) | |
| |
(C++11) |
元素可以是拷贝构造未初始化的存储 原文: element can be copy-constructed in uninitialized storage (概念) |
(C++11) |
元素可以移动,在未初始化的存储构建 原文: element can be move-constructed in uninitialized storage (概念) |
(C++11) |
可以构造未初始化的存储元素 原文: element can be constructed in uninitialized storage (概念) |
| |
一般概念访问某些数据结构内的数据 原文: general concept to access data within some data structure (概念) | |
迭代器,它可用于读出的数据 原文: iterator that can be used to read data (概念) | |
迭代器,它可以用于将数据写入 原文: iterator that can be used to write data (概念) | |
迭代器,它可用于多次读取数据 原文: iterator that can be used to read data multiple times (概念) | |
迭代器,既可以是递增和递减 原文: iterator that can be both incremented and decremented (概念) | |
迭代器,它可以在固定的时间提前 原文: iterator that can be advanced in constant time (概念) | |
| |
流输入功能,不跳过空白字符和计算处理的字符 原文: a stream input function that doesn't skip whitespace and counts the processed characters (概念) | |
流输入功能,跳过开头的空白 原文: a stream input function that skips leading whitespace (概念) | |
的基本流输出功能 (概念) | |
流输出功能,设置failbit上已经存在的错误,并返回一个引用到流 原文: a stream output function that sets failbit on preexisting errors and returns a reference to the stream (概念) | |
| |
(C++11) |
消耗一个整数序列,产生一个32位的无符号值序列 原文: consumes a sequence of integers and produces a sequence of 32-bit unsigned values (概念) |
(C++11) |
返回均匀分布的随机无符号整数 原文: returns uniformly distributed random unsigned integers (概念) |
(C++11) |
一个确定性 UniformRandomNumberGenerator ,所定义的种子 原文: a deterministic UniformRandomNumberGenerator , defined by the seed (概念) |
(C++11) |
的输出转换的另一 RandomNumberEngine 一个RandomNumberEngine 原文: a RandomNumberEngine that transforms the output of another RandomNumberEngine (概念) |
(C++11) |
返回根据一个给定的数学概率密度函数的分布的随机数 原文: returns random numbers distributed according to a given mathematical probability density function (概念) |
| |
(C++11) |
提供独家拥有的语义执行代理(即线程) 原文: provides exclusive ownership semantics for execution agents (i.e. threads) (概念) |
(C++11) |
增加了试图锁定收购 BasicLockable 原文: adds attempted lock acquisition to BasicLockable (概念) |
(C++11) |
(概念) |
(C++11) |
一个 Lockable ,防止数据争用和顺序一致的同步 原文: a Lockable that protects against data races and sequentially consistent synchronization (概念) |
(C++11) |
一个 TimedLockable ,防止数据争用和顺序一致的同步 原文: a TimedLockable that protects against data races and sequentially consistent synchronization (概念) |
| |
(C++11) |
描述属性的类型 (概念) |
(C++11) |
描述了一种在两种类型之间的关系 原文: describes a relationship between two types (概念) |
(C++11) |
修改一个属性的类型 (概念) |
(C++11) |
聚集体的持续时间的时间点,和一个函数来获取当前时间点 原文: aggregates a duration, a time point, and a function to get the current time point (概念) |
(C++11) |
(概念) |
定义类型和字符类型的功能 原文: defines types and functions for a character type (概念) | |
在流中的位置 (概念) | |
表示一个流中的偏移量 (概念) | |
bitset的,整数或枚举 (概念) |
本章尚未完成 原因:Any other missing concept? |