2011-11-25 115 views
1

字符串我有以下情况迭代器阵列

typedef std::array<std::array<string,9>,9>candidates; 
std::vector<candidates>cand; 

我需要遍历字符串递归的深度,并希望他们即使调整大小不变。我该怎么做?我以前使用的迭代器在重新调整尺寸时会失效,我想要一种解决方法..这是以前的尝试。

for(itr[d] = cand[d][i][j].begin(); itr[d] !=cand[d][i][j].end(); ++itr[d]) 
    { 
    //if condition met - proceed to recursive call 

    //else reset (using ppp and push) and proceed to next element of string 
    } 
+0

你得到的错误信息是什么?你能给一个最小的测试用例吗?我的编译器(g ++ 4.5.2)没有投诉它。 – fefe

回答

1

你试过

func(*(itr[d])); 

反引用运算符的优先级高于索引操作。

+0

不..等待..这个问题似乎解决了。 –