1

i have the following situation

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

i need to traverse the strings in depths of recursion and want them unaltered even with re-sizing. how do i do it? the iterators i was using previously get invalidated on re-sizing i want a way around.. here's the previous attempt.

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 
   }
1
  • What is the error message you get? Can you give a minimal test case? My compiler(g++4.5.2) didn't complaint with it. Commented Nov 25, 2011 at 6:36

1 Answer 1

1

Have you tried

func(*(itr[d]));

The dereference operator takes precedence over the indexing operator.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.