由买买提看人间百态

topics

全部话题 - 话题: vertexitr
(共0页)
d****p
发帖数: 685
1
来自主题: Programming版 - Compile issues
正解。
我想说的时我和同事关于一个coding的分歧。
我喜欢用boost::tuple来表示一些临时的数据类型:经常我们在函数中局部定义。我的
同事认为用一个结构更可读。这点说他是对的。对比
typedef boost::tuple Position3D;
以及
struct Position3D
{
int x;
int y;
int z;
};
std::vector vertices;
//...
for (std::vector::iterator vertexItr = vertices.begin();
vertexItr != vertices.end(); ++vertexItr)
{
// vertexItr->x = 0; // local struct more readable
// vertexItr->first = 0; // boost::tuple
}
显然局部结构的代码更可读。
不... 阅读全帖
(共0页)