From f4217af506ef3ce67b028178004728e60e726340 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sun, 18 Sep 2011 15:12:51 -0700 Subject: [PATCH] ostream operator for perm_string objects. --- libmisc/StringHeap.cc | 10 ++++++++++ libmisc/StringHeap.h | 1 + pform_dump.cc | 6 ------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libmisc/StringHeap.cc b/libmisc/StringHeap.cc index 8b8b0cde1..1e8d8fac5 100644 --- a/libmisc/StringHeap.cc +++ b/libmisc/StringHeap.cc @@ -18,6 +18,7 @@ */ # include "StringHeap.h" +# include # include # include # include @@ -199,3 +200,12 @@ bool operator < (perm_string a, perm_string b) return false; } + +ostream& operator << (ostream&out, perm_string that) +{ + if (that.nil()) + out << ""; + else + out << that.str(); + return out; +} diff --git a/libmisc/StringHeap.h b/libmisc/StringHeap.h index e9a1dedd4..fe47156fe 100644 --- a/libmisc/StringHeap.h +++ b/libmisc/StringHeap.h @@ -60,6 +60,7 @@ extern bool operator > (perm_string a, perm_string b); extern bool operator < (perm_string a, perm_string b); extern bool operator >= (perm_string a, perm_string b); extern bool operator <= (perm_string a, perm_string b); +extern ostream& operator << (ostream&out, perm_string that); /* * The string heap is a way to permanently allocate strings diff --git a/pform_dump.cc b/pform_dump.cc index 26621b327..69923ecb6 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -53,12 +53,6 @@ ostream& operator << (ostream&o, const PDelays&d) return o; } -ostream& operator<< (ostream&out, perm_string that) -{ - out << that.str(); - return out; -} - ostream& operator<< (ostream&out, const index_component_t&that) { out << "[";