12
12
#ifndef CPROVER_GOTO_SYMEX_SYMEX_TARGET_EQUATION_H
13
13
#define CPROVER_GOTO_SYMEX_SYMEX_TARGET_EQUATION_H
14
14
15
- #include < list >
15
+ #include < algorithm >
16
16
#include < iosfwd>
17
+ #include < list>
17
18
18
19
#include < util/invariant.h>
19
20
#include < util/merge_irep.h>
@@ -349,24 +350,18 @@ class symex_target_equationt:public symex_targett
349
350
350
351
std::size_t count_assertions () const
351
352
{
352
- std::size_t i=0 ;
353
- for (SSA_stepst::const_iterator
354
- it=SSA_steps.begin ();
355
- it!=SSA_steps.end (); it++)
356
- if (it->is_assert ())
357
- i++;
358
- return i;
353
+ return std::count_if (
354
+ SSA_steps.begin (), SSA_steps.end (), [](const SSA_stept &step) {
355
+ return step.is_assert ();
356
+ });
359
357
}
360
358
361
359
std::size_t count_ignored_SSA_steps () const
362
360
{
363
- std::size_t i=0 ;
364
- for (SSA_stepst::const_iterator
365
- it=SSA_steps.begin ();
366
- it!=SSA_steps.end (); it++)
367
- if (it->ignore )
368
- i++;
369
- return i;
361
+ return std::count_if (
362
+ SSA_steps.begin (), SSA_steps.end (), [](const SSA_stept &step) {
363
+ return step.ignore ;
364
+ });
370
365
}
371
366
372
367
typedef std::list<SSA_stept> SSA_stepst;
@@ -392,13 +387,10 @@ class symex_target_equationt:public symex_targett
392
387
393
388
bool has_threads () const
394
389
{
395
- for (SSA_stepst::const_iterator it=SSA_steps.begin ();
396
- it!=SSA_steps.end ();
397
- it++)
398
- if (it->source .thread_nr !=0 )
399
- return true ;
400
-
401
- return false ;
390
+ return std::any_of (
391
+ SSA_steps.begin (), SSA_steps.end (), [](const SSA_stept &step) {
392
+ return step.source .thread_nr != 0 ;
393
+ });
402
394
}
403
395
404
396
void validate (const namespacet &ns, const validation_modet vm) const
0 commit comments