我已经遇到多的代码,其基本上看起来像这样:固定尺寸C风格阵列
#include<iostream>
// in a header file
class xxx{
public:
xxx() { xxx_[0]=0; xxx_[1]=0; xxx_[2]=0;}
double x0() const {return xxx_[0];}
private:
double xxx_[3]; // ???
};
// in the main.cpp
int main(){
xxx x;
std::cout<<x.x0()<<"\n";
}
问题是---被宣告为一类构件的固定阵列尺寸是否真的被标准所允许?
只是不要让野猪把你的代码中的这些东西无处不在。 – 2012-02-13 12:17:10
@CJohnson:当我第一次看到它时,我的第一反应是,请你马上摆脱那个 – 2012-02-13 13:01:24