用C简单数组声明语法++ [英] Simpler array declaration syntax in C++

查看:246
本文介绍了用C简单数组声明语法++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在围棋的语言,在这里简单的语法被认为是pretty重要精神,这里是在C ++简单数组声明建议:

In the spirit of Go-language, where simpler syntax is considered pretty important, here's a proposal for simpler array declaration in C++:

int   value;
int_1 list;
int_2 table;
int_3 cube;
RECT  rect;
RECT_1 rects;

使用的typedef这可以扩展为:

Using typedefs this can expand to:

int   value;
vector<int> list;
vector<vector<int> > table;
vector<vector<vector<int> > > cube;
RECT  rect;
vector<RECT> rects;

你会使用它,或者是有这样的事情太简单的语法?

Would you use it, or is there such a thing as too simple syntax?

编辑:
有扩张的语法错误..固定矢量&lt; INT&GT; 矢量&lt;矢量&lt; INT&GT; &GT; ..

推荐答案

名携带语义,没有别的呢。 INT_1 在含义上来讲并没有传达了很多,而矢量&lt; INT&GT; 是很清楚这里。

Names carry semantics, nothing else does. int_1 doesn't convey a lot in terms of meaning, whereas vector< int > is quite clear here.

这篇关于用C简单数组声明语法++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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