From: Brian Norris Date: Fri, 10 Aug 2012 23:20:15 +0000 (-0700) Subject: schedule: make print() const X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1f89a2b5691c26417c93d283e73e181bc6cea1a5;p=c11tester.git schedule: make print() const Switch to using a "const_iterator" so that the whole function becomes const. --- diff --git a/schedule.cc b/schedule.cc index 8f7f1a98..69e3d888 100644 --- a/schedule.cc +++ b/schedule.cc @@ -67,7 +67,7 @@ Thread * Scheduler::get_current_thread() const * Print debugging information about the current state of the scheduler. Only * prints something if debugging is enabled. */ -void Scheduler::print() +void Scheduler::print() const { if (current) DEBUG("Current thread: %d\n", current->get_id()); @@ -75,7 +75,7 @@ void Scheduler::print() DEBUG("No current thread\n"); DEBUG("Num. threads in ready list: %zu\n", readyList.size()); - std::list >::iterator it; + std::list >::const_iterator it; for (it = readyList.begin(); it != readyList.end(); it++) DEBUG("In ready list: thread %d\n", (*it)->get_id()); } diff --git a/schedule.h b/schedule.h index 68ef1110..c8153b31 100644 --- a/schedule.h +++ b/schedule.h @@ -20,7 +20,7 @@ public: void remove_thread(Thread *t); Thread * next_thread(); Thread * get_current_thread() const; - void print(); + void print() const; SNAPSHOTALLOC private: