summaryrefslogtreecommitdiff
path: root/utils/crp_table_manager.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-08-12 02:53:28 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-08-12 02:53:28 -0400
commit465abfdb07652238291e807f709292a9ff066366 (patch)
tree7b4f65d8ec611f80e8774bb6d83c384e1c99813d /utils/crp_table_manager.h
parent21373c28b7786b51d1e91529ebb189bfbc4c6dd8 (diff)
clean up CRP code to use faster data structure
Diffstat (limited to 'utils/crp_table_manager.h')
-rw-r--r--utils/crp_table_manager.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/crp_table_manager.h b/utils/crp_table_manager.h
index 32840ad8..753e721f 100644
--- a/utils/crp_table_manager.h
+++ b/utils/crp_table_manager.h
@@ -93,6 +93,10 @@ struct CRPTableManager {
}
}
+ typedef CRPHistogram::const_iterator const_iterator;
+ const_iterator begin() const { return h.begin(); }
+ const_iterator end() const { return h.end(); }
+
unsigned customers;
unsigned tables;
CRPHistogram h;
@@ -100,7 +104,7 @@ struct CRPTableManager {
std::ostream& operator<<(std::ostream& os, const CRPTableManager& tm) {
os << '[' << tm.num_customers() << " total customers at " << tm.num_tables() << " tables ||| ";
- for (CRPHistogram::const_iterator it = tm.h.begin(); it != tm.h.end(); ++it) {
+ for (CRPHistogram::const_iterator it = tm.begin(); it != tm.end(); ++it) {
if (it != tm.h.begin()) os << " -- ";
os << '(' << it->first << ") x " << it->second;
}