model: use std::find for release sequence search
authorBrian Norris <banorris@uci.edu>
Fri, 7 Sep 2012 17:31:08 +0000 (10:31 -0700)
committerBrian Norris <banorris@uci.edu>
Fri, 7 Sep 2012 17:44:42 +0000 (10:44 -0700)
model.cc

index bebd130..37bddaf 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <algorithm>
 
 #include "model.h"
 #include "action.h"
@@ -583,9 +584,8 @@ bool ModelChecker::release_seq_head(const ModelAction *rf,
        action_list_t::const_reverse_iterator rit;
 
        /* Find rf in the thread list */
-       for (rit = list->rbegin(); rit != list->rend(); rit++)
-               if (*rit == rf)
-                       break;
+       rit = std::find(list->rbegin(), list->rend(), rf);
+       ASSERT(rit != list->rend());
 
        /* Find the last write/release */
        for (; rit != list->rend(); rit++)