我有一个结构/类是partiall普通旧数据(POD)。 struct S {
// plain-old-data structs with only arrays and members of basic types (no pointers);
Pod1 pod1;
Pod2 pod2;
Pod3 pod3;
Pod4 pod4;
v
我有一个类和一个const变量。 struct A
{
int b;
};
A const a;
类A是POD,并且可以这样进行初始化。 A const a = { 3 };
恕我直言,它看起来很好有这样的构造函数。 struct A
{
int b;
A(int newB) : b(newB)
{
}
};
但Clang
我经常声明类包装单个Plain Old Data值;简单的类没有虚拟功能,如: class Velocity {
int vel;
public:
// functions to work with velocity ...
}
与这样的对象的工作是相同的与POD的值工作? - 如果在我的代码中使用了int而不是Velocity,那么空间或时间使用情况是否有所不同?标准