add operator << (std::ostream)for Ptr<T>
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 23 Jul 2007 15:23:14 +0200
changeset 966 f06737552914
parent 965 afb54e2e7d59
child 967 19ad9623162c
add operator << (std::ostream)for Ptr<T>
src/core/ptr.h
--- a/src/core/ptr.h	Mon Jul 23 15:22:36 2007 +0200
+++ b/src/core/ptr.h	Mon Jul 23 15:23:14 2007 +0200
@@ -143,6 +143,9 @@
 template <typename T>
 T * GetPointer (const Ptr<T> &p);
 
+template <typename T>
+std::ostream &operator << (std::ostream &, const Ptr<T> &p);
+
 
 // allow if (sp == 0)
 template <typename T1, typename T2>
@@ -290,6 +293,13 @@
   return p.m_ptr;
 }
 
+template <typename T>
+std::ostream &operator << (std::ostream &os, const Ptr<T> &p)
+{
+  os << PeekPointer (p);
+  return os;
+}
+
 template <typename T1, typename T2>
 bool 
 operator == (Ptr<T1> const &lhs, T2 const *rhs)