jeudi 30 avril 2015

The correct syntax of this for loop statement

I have a class, something like:

class A : std::queue<double>
{
  [...]

  void foo();
};

Inside foo() I want to iterate through its elements, but I can't seem to get the syntax right.

I assumed it would be something like: for(auto elem : *this) {} but that doesn't work (a long list of compiler errors). What is the correct syntax?

Aucun commentaire:

Enregistrer un commentaire