Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

c++ - C ++中的POD类型是什么?(What are POD types in C++?)

I've come across this term POD-type a few times.

(我有几次遇到这个术语POD型。)

What does it mean?

(这是什么意思?)

  ask by paxos1977 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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的规则,使它们大大放松,因此需要在此处进行后续回答 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...