From: Leandro Lucarella Date: Sat, 16 Dec 2006 16:49:10 +0000 (+0000) Subject: Mejora debug para IndiceMagico (agregando especialización de template para punteros). X-Git-Tag: entrega-20061218~26 X-Git-Url: https://git.llucax.com/z.facultad/75.68/celdas.git/commitdiff_plain/02829c0a943fc03f7b6c85d18d2d210395f05086?hp=d450338441049b07c816779cbd130ea9cadbc47f Mejora debug para IndiceMagico (agregando especialización de template para punteros). --- diff --git a/trunk/src/indicemagico.h b/trunk/src/indicemagico.h index adbc0cc..a23c975 100644 --- a/trunk/src/indicemagico.h +++ b/trunk/src/indicemagico.h @@ -115,8 +115,20 @@ public: template < typename T > std::ostream& operator<< (std::ostream& os, CIndiceMagico& im) { - for (unsigned i = 0; i < im.count(); ++i) - os << "\t" << im.keys(i) << "=" << im[i] << "\n"; + unsigned c = im.count(); + if (c == 0) return os << "\t\tvacío\n"; + for (unsigned i = 0; i < c; ++i) + os << "\t\t" << im.keys(i) << ":\t" << im[i] << "\n"; + return os; +} + +template < typename T > +std::ostream& operator<< (std::ostream& os, CIndiceMagico& im) +{ + unsigned c = im.count(); + if (c == 0) return os << "\t\tvacío\n"; + for (unsigned i = 0; i < c; ++i) + os << "\t\t" << im.keys(i) << ":\t" << *im[i] << "\n"; return os; }