什么是POD类型 [英] What exactly is a POD type

查看:204
本文介绍了什么是POD类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标准中搜索了普通旧的

数据的确切解释。可能是...我想,内置类型是POD。但是这个怎么样:


struct Data {

int a,b;

};

数据是POD类型吗?


-

问候,

Matthias

解决方案

Matthias写道:

我在标准中搜索了普通旧数据的确切解释。可能是...我想,内置类型是POD。但是这个怎么样:

struct Data {
int a,b;
};

数据是POD类型吗?
。 ..




是。


POD类型的定义在3.9 / 10中给出,部分基于

POD-class的定义在9/4中给出,而这又基于聚合的定义。以8.5.1 / 1给出。


-

祝你好运,

Andrey Tarasevich


"&马蒂亚斯QUOT; <无**** @ digitalraid.com>在消息中写道

新闻:cv ************* @ news.t-online.com

我搜索了标准的确切内容解释什么是普通的旧数据可能是...我想,内置类型是POD。但是呢
这个:

结构数据{
int a,b;
};

数据是POD类型吗?



是的。请参阅C ++ FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-26.7

-

John Carson


John Carson写道:

" Matthias" <无**** @ digitalraid.com>在消息中写道
新闻:cv ************* @ news.t-online.com

我搜索了标准的确切内容解释什么是普通的旧数据可能是...我想,内置类型是POD。但是呢
这个:
结构数据{
int a,b;
};

数据是POD类型吗?



是的。请参阅C ++ FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-26.7




常见问题解答提到POD类型不得包含构造函数或

析构函数。我猜他们的意思/用户定义/ ctor / dtor?因为上面的Data

结构有一个编译器生成的ctor / dtor对吗?这将通过

定义常见问题解答使其成为非POD类型。


-

问候,
Matthias


I searched the standard for an exact explanation of what "plain old
data" might be... I suppose, built-in types are POD. But what about this:

struct Data {
int a,b;
};

Is Data a POD type?

--
Regards,
Matthias

解决方案

Matthias wrote:

I searched the standard for an exact explanation of what "plain old
data" might be... I suppose, built-in types are POD. But what about this:

struct Data {
int a,b;
};

Is Data a POD type?
...



Yes.

The definition of POD type is given in 3.9/10 and is partially based on
definition of "POD-class" given in 9/4, which is in turn based on the
definition of "aggregate" given in 8.5.1/1.

--
Best regards,
Andrey Tarasevich


"Matthias" <no****@digitalraid.com> wrote in message
news:cv*************@news.t-online.com

I searched the standard for an exact explanation of what "plain old
data" might be... I suppose, built-in types are POD. But what about
this:

struct Data {
int a,b;
};

Is Data a POD type?


Yes. See the C++ FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-26.7
--
John Carson


John Carson wrote:

"Matthias" <no****@digitalraid.com> wrote in message
news:cv*************@news.t-online.com

I searched the standard for an exact explanation of what "plain old
data" might be... I suppose, built-in types are POD. But what about
this:
struct Data {
int a,b;
};

Is Data a POD type?



Yes. See the C++ FAQ:

http://www.parashift.com/c++-faq-lit....html#faq-26.7



The FAQ mention that POD types must not have constructors or a
destructor. I guess they mean /user defined/ ctor/dtor? Because the Data
struct above has a compiler generated ctor/dtor right? This would by
definition of the FAQ make it a non-POD type.

--
Regards,
Matthias


这篇关于什么是POD类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆