开发者

Tips for writing the least verbose Visual C++ code you can in Visual Studio 2005?

While I realize that Visual C++ is a language lacking much of the synta开发者_如何学编程ctic-sugar that most of us new programmers are used to these days, VC++ 2005 must have some shortcuts that can decrease the verbosity of the code at least a little; does anyone know of these, or is c++ just that verbose?


VC++ offers a couple of extensions that are not part of C++ standard, the only one that comes to my mind right now is "for each" but I can't see why somebody would use it since boost offers a portable implementation.

std::vector<int> vec;
for each(int i in vec)
{
    // do something with i
}

The only other advice is to use standard library and boost as much as possible and not reinvent the things somebody else had already implemented (probably much better than you could).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜