C ++中的POD类型是什么? [英] What are POD types in C++?
问题描述
我碰到过这个词POD类型几次...这是什么意思?
I've come across this term POD-type a few times... what does it mean?
推荐答案
POD 代表原始数据类(无论是否使用关键字 struct
或关键字 class
定义),没有构造函数,析构函数和虚拟成员函数。 维基百科的POD文章有更多细节,并将其定义为:
POD stands for Plain Old Data - that is, a class (whether defined with the keyword struct
or the keyword class
) without constructors, destructors and virtual members functions. Wikipedia's article on POD goes into a bit more detail and defines it as:
C ++中的普通数据结构是一个只包含PODS作为成员的聚合类,没有用户定义的析构函数,没有用户定义的复制赋值操作符,也没有指针的非静态成员
A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-defined copy assignment operator, and no nonstatic members of pointer-to-member type.
有关详细信息,请访问这个答案为C ++ 98/03 。 C ++ 11改变了围绕POD的规则,大大放松了它们,因此这里需要一个后续回答。
Greater detail can be found in this answer for C++98/03. C++11 changed the rules surrounding POD, relaxing them greatly, thus necessitating a follow-up answer here.
这篇关于C ++中的POD类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!