]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/shared_ptr.hpp
complie fix
[lyx.git] / boost / boost / shared_ptr.hpp
index 78698a7885d27662924deb90762fdcc056e6e3f7..8f55948ff4c858d29de57558dd396276399526fd 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <boost/assert.hpp>
 #include <boost/checked_delete.hpp>
-
+#include <boost/throw_exception.hpp>
 #include <boost/detail/shared_count.hpp>
 
 #include <memory>             // for std::auto_ptr
@@ -90,6 +90,7 @@ private:
 public:
 
     typedef T element_type;
+    typedef T value_type;
 
     shared_ptr(): px(0), pn()
     {
@@ -135,19 +136,19 @@ public:
     template<typename Y>
     shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
     {
-       if (px == 0) // need to allocate new counter -- the cast failed
-       {
-           pn = detail::shared_count();
-       }
+        if (px == 0) // need to allocate new counter -- the cast failed
+        {
+            pn = detail::shared_count();
+        }
     }
 
     template<typename Y>
     shared_ptr(shared_ptr<Y> const & r, detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
     {
-       if (px == 0)
-       {
-           throw std::bad_cast();
-       }
+        if (px == 0)
+        {
+            boost::throw_exception(std::bad_cast());
+        }
     }
 
 #ifndef BOOST_NO_AUTO_PTR
@@ -164,9 +165,9 @@ public:
     template<typename Y>
     shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
     {
-       px = r.px;
-       pn = r.pn; // shared_count::op= doesn't throw
-       return *this;
+        px = r.px;
+        pn = r.pn; // shared_count::op= doesn't throw
+        return *this;
     }
 
 #endif
@@ -176,43 +177,43 @@ public:
     template<typename Y>
     shared_ptr & operator=(std::auto_ptr<Y> & r)
     {
-       this_type(r).swap(*this);
-       return *this;
+        this_type(r).swap(*this);
+        return *this;
     }
 
 #endif
 
     void reset()
     {
-       this_type().swap(*this);
+        this_type().swap(*this);
     }
 
     template<typename Y> void reset(Y * p) // Y must be complete
     {
-       BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
-       this_type(p).swap(*this);
+        BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
+        this_type(p).swap(*this);
     }
 
     template<typename Y, typename D> void reset(Y * p, D d)
     {
-       this_type(p, d).swap(*this);
+        this_type(p, d).swap(*this);
     }
 
     typename detail::shared_ptr_traits<T>::reference operator* () const // never throws
     {
-       BOOST_ASSERT(px != 0);
-       return *px;
+        BOOST_ASSERT(px != 0);
+        return *px;
     }
 
     T * operator-> () const // never throws
     {
-       BOOST_ASSERT(px != 0);
-       return px;
+        BOOST_ASSERT(px != 0);
+        return px;
     }
-
+    
     T * get() const // never throws
     {
-       return px;
+        return px;
     }
 
     // implicit conversion to "bool"
@@ -221,28 +222,28 @@ public:
 
     operator unspecified_bool_type() const // never throws
     {
-       return px == 0? 0: &this_type::get;
+        return px == 0? 0: &this_type::get;
     }
 
     bool operator! () const // never throws
     {
-       return px == 0;
+        return px == 0;
     }
 
     bool unique() const // never throws
     {
-       return pn.unique();
+        return pn.unique();
     }
 
     long use_count() const // never throws
     {
-       return pn.use_count();
+        return pn.use_count();
     }
 
     void swap(shared_ptr<T> & other) // never throws
     {
-       std::swap(px, other.px);
-       pn.swap(other.pn);
+        std::swap(px, other.px);
+        pn.swap(other.pn);
     }
 
 // Tasteless as this may seem, making all members public allows member templates
@@ -348,7 +349,7 @@ template<class T> shared_ptr<T> shared_from_this(T * p)
 
 #ifdef BOOST_MSVC
 # pragma warning(pop)
-#endif
+#endif    
 
 #endif  // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)