c++ - Comparing strings in qt doesn't work -
i'm trying compare 2 strings default in qt fails. it's false
the statement if group == default, goes s.begingroup, group called default. don't know problem, that's weird.
 foreach (const qstring &group, s.childgroups()) {         if(group =="default")             continue;         s.begingroup(group);         profile *profile = new profile();         profile->setobjectname(group);         profile->load(s);         s.endgroup();          m_profiles << profile;      }      
the definition of foreach in qt resolves following:
#  define q_foreach(variable, container)                                \ (qforeachcontainer<qt_foreach_decltype(container)>  _container_((container)); \  _container_.control && _container_.i != _container_.e;         \  ++_container_.i, _container_.control ^= 1)                     \     (variable = *_container_.i; _container_.control; _container_.control = 0)   so can see there 2 for loops, possibly continue keyword not continue 1 to, inner one.
edit after @chi's comment
there nice explanation in qt header file:
// explanation of control word: //  - it's initialized 1 //  - means both inner , outer loops start //  - if there no breaks, @ end of inner loop, it's set 0, //    causes exit (the inner loop run once) //  - @ end of outer loop, it's inverted, becomes 1 again, allowing //    outer loop continue executing //  - if there break inside inner loop, exit control still //    set 1; in case, outer loop invert 0 , exit   as can see there no mention of continue break. , there no mention of continue on foreach documentation page either: http://doc.qt.io/qt-4.8/containers.html#the-foreach-keyword break presented.
Comments
Post a Comment