By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

POD-ness of a type

P: n/a

Hello all,

It appears that 3.9/10 and 9/4 taken together define POD. The definition
does not seem to exclude base-class subobjects that are non-POD (though it
does exclude data members that are non-POD). So...

class base // non-POD due to str
{
public:
string str;
};

class derived: public base // POD?????
{
public:
int a;
};

According to my interpretation, derived would be POD. This sure doesn't
seem right though. What am I missing?

Thanks,
Dave
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Dave" <be***********@yahoo.com> wrote...
It appears that 3.9/10 and 9/4 taken together define POD. The definition
does not seem to exclude base-class subobjects that are non-POD (though it
does exclude data members that are non-POD). So...

class base // non-POD due to str
{
public:
string str;
};

class derived: public base // POD?????
No.
{
public:
int a;
};

According to my interpretation, derived would be POD. This sure doesn't
seem right though. What am I missing?


You're missing the word "aggregate" in 9/4. Read the definition of
an aggregate in 8.5.1.

Victor
Jul 22 '05 #2

P: n/a
Dave wrote:
...
It appears that 3.9/10 and 9/4 taken together define POD. The definition
does not seem to exclude base-class subobjects that are non-POD (though it
does exclude data members that are non-POD). So...

class base // non-POD due to str
{
public:
string str;
};

class derived: public base // POD?????
{
public:
int a;
};

According to my interpretation, derived would be POD. This sure doesn't
seem right though. What am I missing?
...


Read the definition again. Only _aggregate_ classes can be POD-classes.
The term "aggregate" is defined in 8.5.1/1

--
Best regards,
Andrey Tarasevich

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.