From c97eebabf7e2b569fda8749b2136da676ff611c1 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Nov 2009 20:11:05 +0000 Subject: [PATCH] Fix enable_shared_from_this example. Refs #3404. [SVN r57950] --- enable_shared_from_this.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/enable_shared_from_this.html b/enable_shared_from_this.html index 3f35665..c4caa25 100644 --- a/enable_shared_from_this.html +++ b/enable_shared_from_this.html @@ -29,20 +29,24 @@ and shared_ptr<T const>, depending on constness, to this.

Example

-class Y: public enable_shared_from_this<Y>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/shared_ptr.hpp>
+#include <cassert>
+
+class Y: public boost::enable_shared_from_this<Y>
 {
 public:
 
-    shared_ptr<Y> f()
+    boost::shared_ptr<Y> f()
     {
         return shared_from_this();
     }
-}
+};
 
 int main()
 {
-    shared_ptr<Y> p(new Y);
-    shared_ptr<Y> q = p->f();
+    boost::shared_ptr<Y> p(new Y);
+    boost::shared_ptr<Y> q = p->f();
     assert(p == q);
     assert(!(p < q || q < p)); // p and q must share ownership
 }