diff --git a/hprint.cpp b/hprint.cpp index e2789ac0..7789a3a1 100644 --- a/hprint.cpp +++ b/hprint.cpp @@ -231,6 +231,13 @@ template void print(hstream& hs, const vector& a) { print(hs, "("); template void print(hstream& hs, const map& a) { print(hs, "("); comma_printer c(hs); for(auto& t: a) c(t); print(hs, ")"); } +template string separated(string separator, const vector& a) { + shstream ss; + bool first = true; + for(auto& v: a) { if(first) first = false; else print(ss, separator); print(ss, v); } + return ss.s; + } + inline void print(hstream& hs, const hyperpoint h) { print(hs, (const array&)h); } inline void print(hstream& hs, const transmatrix T) { print(hs, "("); comma_printer c(hs); @@ -300,6 +307,10 @@ struct indenter { struct indenter_finish : indenter { explicit indenter_finish(bool b = true): indenter(b ? 2:0) {} + explicit indenter_finish(string s): indenter(2) { + indenter tmp(-2); + println(hlog, s); + } ~indenter_finish() { if(hlog.indentation != ind.backup) println(hlog, "(done)"); } };