ostream operator for perm_string objects.

This commit is contained in:
Stephen Williams 2011-09-18 15:12:51 -07:00
parent 4d445dc269
commit f4217af506
3 changed files with 11 additions and 6 deletions

View File

@ -18,6 +18,7 @@
*/
# include "StringHeap.h"
# include <iostream>
# include <cstdlib>
# include <cstring>
# include <cassert>
@ -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 << "<nil>";
else
out << that.str();
return out;
}

View File

@ -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

View File

@ -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 << "[";