Comment 3 for bug 1203629

Revision history for this message
SirVer (sirver) wrote : Re: [Bug 1203629] Re: Replace boost::foreach and container iterate with range based for loops

Make a few first and send for review so that we can iron out style questions before we need to retouch hundreds of code lines later.

> Am 16.07.2014 um 22:09 schrieb GunChleoc <email address hidden>:
>
> I found a code example in a recent merge request, so I can take this one
> on
>
> 18 - container_iterate_const(std::vector<TribeBasicInfo>, s.tribes, i)
> 19 - if (i.current->name == player.tribe) {
> 20 + for (const TribeBasicInfo tmp_tribe : s.tribes)
> 21 + {
> 22 + if (tmp_tribe.name == player.tribe) {
> 23 s.players[number].tribe = actual_tribe;
> 24 - if (i.current->initializations.size() <= player.initialization_index) {
> 25 + if (tmp_tribe.initializations.size() <= player.initialization_index) {
> 26 player.initialization_index = 0;
> 27 }
> 28 }
> 29 + }
>
> ** Changed in: widelands
> Assignee: (unassigned) => GunChleoc (gunchleoc)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1203629
>
> Title:
> Replace boost::foreach and container iterate with range based for
> loops
>
> Status in Widelands:
> Confirmed
>
> Bug description:
> I wanted to work on this right now, but realized that range based for
> are only supported with gcc >= 4.6, so it seems a little early to jump
> ship here. After b18 we should reconsider doing this move though.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/widelands/+bug/1203629/+subscriptions