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.
(POD代表普通旧数据 - 即没有构造函数,析构函数和虚拟成员函数的类(无论是使用关键字struct
还是关键字class
)。)
Wikipedia's article on POD goes into a bit more detail and defines it as: (维基百科关于POD的文章更详细,并将其定义为:)
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 ++中的普通旧数据结构是一个聚合类,它只包含PODS作为成员,没有用户定义的析构函数,没有用户定义的复制赋值运算符,也没有指向成员类型的非静态成员。)
Greater detail can be found in this answer for C++98/03 .
(在C ++ 98/03的答案中可以找到更多细节。)
C++11 changed the rules surrounding POD, relaxing them greatly, thus necessitating a follow-up answer here . (C ++ 11改变了围绕POD的规则,使它们大大放松,因此需要在此处进行后续回答 。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…