归档 2010年9月20日

最后更新于 .

今天在翻unix网络编程的时候,无意中看到了使用匿名定义结构体/类定义数组的一段代码。

于是写了测试代码如下:

#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

struct st
{
    int a;
    int b;
    char *p;
    int c;
}sts[]={
    {1,1,"hh",1},
    {2,2,"ff",2}
};

class CObj
{
    public:
        int a;
        string s;
        int b;

}objs[]={
    {1,"x",11},
    {2,"y",22}
};

int main(int argc, const ...

昨天

2010年9月16日

明天

2010年9月26日

归档