Thursday 15 January 2015

c++ - How can I reach the value which iterator is pointing at? -


I have a certain std :: list of some types, for example list & lt; FILE & gt; I need every access to all the values ​​stored in it, for example:

  list & lt; FILE & gt; :: iterator iter; (IARR = Preferences :: OpenFD.bizen); IARAR! = Preferences :: OpenFD.and (IRAR ++) {Falcos (ITR); }   

This does not work because it is not a file. How can I get the price at which I am pointing to it?

Just use a dereference operator:

  fclose (* Ether); // ^ << / code>  

Note also, fclose a FILE * , not FILE is expected.

With C ++ 11 you can use category-based for:

 For  (Auto & Preferences: Preferences :: OpenFD) Falcos (AMM);   

Or you can also use std :: for_each :

  std :: for_each (preference :: OpenFD) .begin), Preferences :: OpenFD.and (), Ficlos);    

No comments:

Post a Comment