There are happy people working with boost and Qt. In my current “embedded” project, I have to use container classes for home use. Ok, enough to complain.
I tried to implement a simple and standalone foreach:
#define ForEachString(S,C) TString S;\ for ( int i=0; i<C.GetSize() && (!!(&(S=C[i]))); ++i )
Iterates through a string list that has the op [] and GetSize () methods. For example:.
TStringList tables; ForEachString( table, tables ) { //do sth. with tab. }
Because of the ugly thing, each type of container requires its own macro. So my question is: is it possible to make the container independent and still autonomous (all the macro definition needed inside )?
Regards, Valentin
c ++
Valentin heinitz
source share