Factor out sorted list insertion into utility function
[clinton/bobotpp.git] / source / BotInterp.C
index 9a07be6..8b58d3e 100644 (file)
@@ -150,13 +150,7 @@ BotInterp::AddTimer(int delay, SCM function)
   scm_gc_protect_object(function);
 
   Timer *timer = new Timer (++counter, when, function);
-  TimerList::iterator it = std::find_if (timers.begin (), timers.end (),
-                                        std::bind1st (timer_sort_p, timer));
-  
-  if (it != timers.end ())
-    timers.insert (it, timer);
-  else
-    timers.push_back (timer);
+  Utils::push_sorted (timers, timer, timer_sort_p);
 
   return scm_from_int (counter);