From b32ff0504c4eb2e446155cfa858f5aa19a119082 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Wed, 1 May 2013 22:35:35 -0400 Subject: [PATCH] Gotta love loops that can be done with any_of. --- src/SongUtil.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index 4eea4e07ba..75baa4d0a7 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -951,8 +951,8 @@ void SongUtil::GetPlayableStepsTypes( const Song *pSong, set &vOut ) } set vStepsTypes; - FOREACH( const Style*, vpPossibleStyles, s ) - vStepsTypes.insert( (*s)->m_StepsType ); + for (Style const *s : vpPossibleStyles) + vStepsTypes.insert( s->m_StepsType ); /* filter out hidden StepsTypes, and remove steps that we don't have enough * stages left to play. */ @@ -1005,15 +1005,9 @@ bool SongUtil::IsSongPlayable( Song *s ) { const vector & steps = s->GetAllSteps(); // I'm sure there is a foreach loop, but I don't - FOREACH( Steps*, const_cast&>(steps), step ) - { - if (IsStepsPlayable(s, *step)) - { - return true; - } - } - - return false; + return std::any_of(steps.begin(), steps.end(), [&](Steps *step) { + return IsStepsPlayable(s, step); + }); } bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &stOut, Difficulty &dcOut )