我有一个关于迭代器的问题.问题是:"我如何访问(如果它是嵌套迭代器)行中的元素,更高或更低.这是我的意思的一个例子:
for( auto i = graphMatrix.begin();i != graphMatrix.end();i++ )
{
for( auto j = i->begin();j != i->end();j++ )
{
if( *j == 'O' )
{
// here we must analyze an element which is a row higher or lower
}
}
}
Run Code Online (Sandbox Code Playgroud)
接下来就是我想做的事情(但它是矢量):
for( int i = graphMatrix.size();i < graphMatrix.size();i++ )
{
for( int j = graphMatrix.size();j < graphMatrix.size();j++ )
{
if( graphMatrix[i][j] == 'O' )
{
graphMatrix[j][i] == 'X';
}
}
}
Run Code Online (Sandbox Code Playgroud)
我知道向量具有快速的大小函数,但是为了概括代码,在我看来,最好使用迭代器(正如我的导师所说).那么如何使用迭代器和向量一样做呢?
你怎么能这样做SetWindowText( static_label, "I know this thing" + myString )?