class sp_counted_base_impl: public sp_counted_base
+{
+private:
+
+ P ptr; // copy constructor must not throw
+ D del; // copy constructor must not throw
+
+ sp_counted_base_impl(sp_counted_base_impl const &);
+ sp_counted_base_impl & operator= (sp_counted_base_impl const &);
+
+ typedef sp_counted_base_impl this_type;
+
+public:
+
+ // pre: initial_use_count <= initial_weak_count, d(p) must not throw
+
+ sp_counted_base_impl(P p, D d): ptr(p), del(d)
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ detail::cbi_call_constructor_hook(this, p, d, 0);
+#endif
+ }
+
+ virtual void dispose() // nothrow
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ detail::cbi_call_destructor_hook(this, ptr, del, 0);
+#endif
+ del(ptr);
+ }
+
+ virtual void * get_deleter(std::type_info const & ti)
+ {
+ return ti == typeid(D)? &del: 0;
+ }
+
+#if defined(BOOST_SP_USE_STD_ALLOCATOR)
+
+ void * operator new(std::size_t)
+ {
+ return std::allocator().allocate(1, static_cast(0));
+ }
+
+ void operator delete(void * p)
+ {
+ std::allocator().deallocate(static_cast(p), 1);
+ }
+
+#endif
+
+#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
+
+ void * operator new(std::size_t)
+ {
+ return quick_allocator::alloc();
+ }
+
+ void operator delete(void * p)
+ {
+ quick_allocator::dealloc(p);
+ }
+
+#endif
+};
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+int const shared_count_id = 0x2C35F101;
+int const weak_count_id = 0x298C38A4;
+
+#endif
+
+class weak_count;
+
+class shared_count
+{
+private:
+
+ sp_counted_base * pi_;
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ int id_;
+#endif
+
+ friend class weak_count;
+
+public:
+
+ shared_count(): pi_(0) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ }
+
+ template shared_count(P p, D d): pi_(0)
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try
+ {
+ pi_ = new sp_counted_base_impl(p, d);
+ }
+ catch(...)
+ {
+ d(p); // delete p
+ throw;
+ }
+
+#else
+
+ pi_ = new sp_counted_base_impl
(p, d);
+
+ if(pi_ == 0)
+ {
+ d(p); // delete p
+ boost::throw_exception(std::bad_alloc());
+ }
+
+#endif
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ // auto_ptr is special cased to provide the strong guarantee
+
+ template
+ explicit shared_count(std::auto_ptr & r): pi_(new sp_counted_base_impl< Y *, checked_deleter >(r.get(), checked_deleter()))
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ r.release();
+ }
+
+#endif
+
+ ~shared_count() // nothrow
+ {
+ if(pi_ != 0) pi_->release();
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ id_ = 0;
+#endif
+ }
+
+ shared_count(shared_count const & r): pi_(r.pi_) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ if(pi_ != 0) pi_->add_ref_copy();
+ }
+
+ explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0
+
+ shared_count & operator= (shared_count const & r) // nothrow
+ {
+ sp_counted_base * tmp = r.pi_;
+ if(tmp != 0) tmp->add_ref_copy();
+ if(pi_ != 0) pi_->release();
+ pi_ = tmp;
+
+ return *this;
+ }
+
+ void swap(shared_count & r) // nothrow
+ {
+ sp_counted_base * tmp = r.pi_;
+ r.pi_ = pi_;
+ pi_ = tmp;
+ }
+
+ long use_count() const // nothrow
+ {
+ return pi_ != 0? pi_->use_count(): 0;
+ }
+
+ bool unique() const // nothrow
+ {
+ return use_count() == 1;
+ }
+
+ friend inline bool operator==(shared_count const & a, shared_count const & b)
+ {
+ return a.pi_ == b.pi_;
+ }
+
+ friend inline bool operator<(shared_count const & a, shared_count const & b)
+ {
+ return std::less()(a.pi_, b.pi_);
+ }
+
+ void * get_deleter(std::type_info const & ti) const
+ {
+ return pi_? pi_->get_deleter(ti): 0;
+ }
+};
+
+#ifdef __CODEGUARD__
+# pragma option pop
+#endif
+
+
+class weak_count
+{
+private:
+
+ sp_counted_base * pi_;
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ int id_;
+#endif
+
+ friend class shared_count;
+
+public:
+
+ weak_count(): pi_(0) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(weak_count_id)
+#endif
+ {
+ }
+
+ weak_count(shared_count const & r): pi_(r.pi_) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ if(pi_ != 0) pi_->weak_add_ref();
+ }
+
+ weak_count(weak_count const & r): pi_(r.pi_) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+ if(pi_ != 0) pi_->weak_add_ref();
+ }
+
+ ~weak_count() // nothrow
+ {
+ if(pi_ != 0) pi_->weak_release();
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ id_ = 0;
+#endif
+ }
+
+ weak_count & operator= (shared_count const & r) // nothrow
+ {
+ sp_counted_base * tmp = r.pi_;
+ if(tmp != 0) tmp->weak_add_ref();
+ if(pi_ != 0) pi_->weak_release();
+ pi_ = tmp;
+
+ return *this;
+ }
+
+ weak_count & operator= (weak_count const & r) // nothrow
+ {
+ sp_counted_base * tmp = r.pi_;
+ if(tmp != 0) tmp->weak_add_ref();
+ if(pi_ != 0) pi_->weak_release();
+ pi_ = tmp;
+
+ return *this;
+ }
+
+ void swap(weak_count & r) // nothrow
+ {
+ sp_counted_base * tmp = r.pi_;
+ r.pi_ = pi_;
+ pi_ = tmp;
+ }
+
+ long use_count() const // nothrow
+ {
+ return pi_ != 0? pi_->use_count(): 0;
+ }
+
+ friend inline bool operator==(weak_count const & a, weak_count const & b)
+ {
+ return a.pi_ == b.pi_;
+ }
+
+ friend inline bool operator<(weak_count const & a, weak_count const & b)
+ {
+ return std::less()(a.pi_, b.pi_);
+ }
+};
+
+inline shared_count::shared_count(weak_count const & r): pi_(r.pi_)
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+{
+ if(pi_ != 0)
+ {
+ pi_->add_ref_lock();
+ }
+ else
+ {
+ boost::throw_exception(boost::bad_weak_ptr());
+ }
+}
+
+} // namespace detail
+
+} // namespace boost
+
+#ifdef __BORLANDC__
+# pragma warn .8027 // Functions containing try are not expanded inline
+# pragma warn .8026 // Functions with excep. spec. are not expanded inline
+#endif
+
+#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
diff --git a/include/boost/detail/shared_ptr_nmt.hpp b/include/boost/detail/shared_ptr_nmt.hpp
new file mode 100644
index 0000000..14fbe65
--- /dev/null
+++ b/include/boost/detail/shared_ptr_nmt.hpp
@@ -0,0 +1,183 @@
+#ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
+#define BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
+
+//
+// detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
+//
+
+#include
+#include
+#include
+#include
+
+#ifndef BOOST_NO_AUTO_PTR
+# include // for std::auto_ptr
+#endif
+
+#include // for std::swap
+#include // for std::less
+#include // for std::bad_alloc
+
+namespace boost
+{
+
+template class shared_ptr
+{
+private:
+
+ typedef detail::atomic_count count_type;
+
+public:
+
+ typedef T element_type;
+ typedef T value_type;
+
+ explicit shared_ptr(T * p = 0): px(p)
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try // prevent leak if new throws
+ {
+ pn = new count_type(1);
+ }
+ catch(...)
+ {
+ boost::checked_delete(p);
+ throw;
+ }
+
+#else
+
+ pn = new count_type(1);
+
+ if(pn == 0)
+ {
+ boost::checked_delete(p);
+ boost::throw_exception(std::bad_alloc());
+ }
+
+#endif
+ }
+
+ ~shared_ptr()
+ {
+ if(--*pn == 0)
+ {
+ boost::checked_delete(px);
+ delete pn;
+ }
+ }
+
+ shared_ptr(shared_ptr const & r): px(r.px) // never throws
+ {
+ pn = r.pn;
+ ++*pn;
+ }
+
+ shared_ptr & operator=(shared_ptr const & r)
+ {
+ shared_ptr(r).swap(*this);
+ return *this;
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ explicit shared_ptr(std::auto_ptr & r)
+ {
+ pn = new count_type(1); // may throw
+ px = r.release(); // fix: moved here to stop leak if new throws
+ }
+
+ shared_ptr & operator=(std::auto_ptr & r)
+ {
+ shared_ptr(r).swap(*this);
+ return *this;
+ }
+
+#endif
+
+ void reset(T * p = 0)
+ {
+ BOOST_ASSERT(p == 0 || p != px);
+ shared_ptr(p).swap(*this);
+ }
+
+ T & operator*() const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ return *px;
+ }
+
+ T * operator->() const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ return px;
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+ long use_count() const // never throws
+ {
+ return *pn;
+ }
+
+ bool unique() const // never throws
+ {
+ return *pn == 1;
+ }
+
+ void swap(shared_ptr & other) // never throws
+ {
+ std::swap(px, other.px);
+ std::swap(pn, other.pn);
+ }
+
+private:
+
+ T * px; // contained pointer
+ count_type * pn; // ptr to reference counter
+};
+
+template inline bool operator==(shared_ptr const & a, shared_ptr const & b)
+{
+ return a.get() == b.get();
+}
+
+template inline bool operator!=(shared_ptr const & a, shared_ptr const & b)
+{
+ return a.get() != b.get();
+}
+
+template inline bool operator<(shared_ptr const & a, shared_ptr const & b)
+{
+ return std::less()(a.get(), b.get());
+}
+
+template void swap(shared_ptr & a, shared_ptr & b)
+{
+ a.swap(b);
+}
+
+// get_pointer() enables boost::mem_fn to recognize shared_ptr
+
+template inline T * get_pointer(shared_ptr const & p)
+{
+ return p.get();
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
diff --git a/include/boost/enable_shared_from_this.hpp b/include/boost/enable_shared_from_this.hpp
new file mode 100644
index 0000000..d3f8ab8
--- /dev/null
+++ b/include/boost/enable_shared_from_this.hpp
@@ -0,0 +1,68 @@
+#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+
+//
+// enable_shared_from_this.hpp
+//
+// Copyright (c) 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
+//
+
+#include
+#include
+#include
+#include
+
+namespace boost
+{
+
+template class enable_shared_from_this
+{
+protected:
+
+ enable_shared_from_this()
+ {
+ }
+
+ enable_shared_from_this(enable_shared_from_this const &)
+ {
+ }
+
+ enable_shared_from_this & operator=(enable_shared_from_this const &)
+ {
+ return *this;
+ }
+
+ ~enable_shared_from_this()
+ {
+ }
+
+public:
+
+ shared_ptr shared_from_this()
+ {
+ shared_ptr p(_internal_weak_this);
+ BOOST_ASSERT(p.get() == this);
+ return p;
+ }
+
+ shared_ptr shared_from_this() const
+ {
+ shared_ptr p(_internal_weak_this);
+ BOOST_ASSERT(p.get() == this);
+ return p;
+ }
+
+ typedef T _internal_element_type; // for bcc 5.5.1
+ weak_ptr<_internal_element_type> _internal_weak_this;
+};
+
+} // namespace boost
+
+#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
diff --git a/include/boost/get_pointer.hpp b/include/boost/get_pointer.hpp
new file mode 100644
index 0000000..09091e4
--- /dev/null
+++ b/include/boost/get_pointer.hpp
@@ -0,0 +1,30 @@
+// Copyright Peter Dimov and David Abrahams 2002. Permission to copy,
+// use, modify, sell and distribute this software is granted provided
+// this copyright notice appears in all copies of the source. This
+// software is provided "as is" without express or implied warranty,
+// and with no claim as to its suitability for any purpose.
+#ifndef GET_POINTER_DWA20021219_HPP
+# define GET_POINTER_DWA20021219_HPP
+
+# include
+
+namespace boost {
+
+// get_pointer(p) extracts a ->* capable pointer from p
+
+template T * get_pointer(T * p)
+{
+ return p;
+}
+
+// get_pointer(shared_ptr const & p) has been moved to shared_ptr.hpp
+
+template T * get_pointer(std::auto_ptr const& p)
+{
+ return p.get();
+}
+
+
+} // namespace boost
+
+#endif // GET_POINTER_DWA20021219_HPP
diff --git a/include/boost/intrusive_ptr.hpp b/include/boost/intrusive_ptr.hpp
new file mode 100644
index 0000000..7db6dcf
--- /dev/null
+++ b/include/boost/intrusive_ptr.hpp
@@ -0,0 +1,273 @@
+#ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED
+#define BOOST_INTRUSIVE_PTR_HPP_INCLUDED
+
+//
+// intrusive_ptr.hpp
+//
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation.
+//
+
+#include
+
+#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
+# pragma warning(push)
+# pragma warning(disable:4284) // odd return type for operator->
+#endif
+
+#include
+#include
+
+#include // for std::less
+#include // for std::basic_ostream
+
+
+namespace boost
+{
+
+//
+// intrusive_ptr
+//
+// A smart pointer that uses intrusive reference counting.
+//
+// Relies on unqualified calls to
+//
+// void intrusive_ptr_add_ref(T * p);
+// void intrusive_ptr_release(T * p);
+//
+// (p != 0)
+//
+// The object is responsible for destroying itself.
+//
+
+template class intrusive_ptr
+{
+private:
+
+ typedef intrusive_ptr this_type;
+
+public:
+
+ typedef T element_type;
+
+ intrusive_ptr(): p_(0)
+ {
+ }
+
+ intrusive_ptr(T * p, bool add_ref = true): p_(p)
+ {
+ if(p_ != 0 && add_ref) intrusive_ptr_add_ref(p_);
+ }
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+ template intrusive_ptr(intrusive_ptr const & rhs): p_(rhs.get())
+ {
+ if(p_ != 0) intrusive_ptr_add_ref(p_);
+ }
+
+#endif
+
+ intrusive_ptr(intrusive_ptr const & rhs): p_(rhs.p_)
+ {
+ if(p_ != 0) intrusive_ptr_add_ref(p_);
+ }
+
+ ~intrusive_ptr()
+ {
+ if(p_ != 0) intrusive_ptr_release(p_);
+ }
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+ template intrusive_ptr & operator=(intrusive_ptr const & rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+#endif
+
+ intrusive_ptr & operator=(intrusive_ptr const & rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+ intrusive_ptr & operator=(T * rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+ T * get() const
+ {
+ return p_;
+ }
+
+ T & operator*() const
+ {
+ return *p_;
+ }
+
+ T * operator->() const
+ {
+ return p_;
+ }
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return p_ != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return p_ == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type () const
+ {
+ return p_ == 0? 0: &this_type::p_;
+ }
+
+#endif
+
+ // operator! is a Borland-specific workaround
+ bool operator! () const
+ {
+ return p_ == 0;
+ }
+
+ void swap(intrusive_ptr & rhs)
+ {
+ T * tmp = p_;
+ p_ = rhs.p_;
+ rhs.p_ = tmp;
+ }
+
+private:
+
+ T * p_;
+};
+
+template inline bool operator==(intrusive_ptr const & a, intrusive_ptr const & b)
+{
+ return a.get() == b.get();
+}
+
+template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b)
+{
+ return a.get() != b.get();
+}
+
+template inline bool operator==(intrusive_ptr const & a, T * b)
+{
+ return a.get() == b;
+}
+
+template inline bool operator!=(intrusive_ptr const & a, T * b)
+{
+ return a.get() != b;
+}
+
+template inline bool operator==(T * a, intrusive_ptr const & b)
+{
+ return a == b.get();
+}
+
+template inline bool operator!=(T * a, intrusive_ptr const & b)
+{
+ return a != b.get();
+}
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
+
+// Resolve the ambiguity between our op!= and the one in rel_ops
+
+template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b)
+{
+ return a.get() != b.get();
+}
+
+#endif
+
+template inline bool operator<(intrusive_ptr const & a, intrusive_ptr const & b)
+{
+ return std::less()(a.get(), b.get());
+}
+
+template void swap(intrusive_ptr & lhs, intrusive_ptr & rhs)
+{
+ lhs.swap(rhs);
+}
+
+// mem_fn support
+
+template T * get_pointer(intrusive_ptr const & p)
+{
+ return p.get();
+}
+
+template intrusive_ptr static_pointer_cast(intrusive_ptr const & p)
+{
+ return static_cast(p.get());
+}
+
+template intrusive_ptr const_pointer_cast(intrusive_ptr const & p)
+{
+ return const_cast(p.get());
+}
+
+template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p)
+{
+ return dynamic_cast(p.get());
+}
+
+// operator<<
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+
+template std::ostream & operator<< (std::ostream & os, intrusive_ptr const & p)
+{
+ os << p.get();
+ return os;
+}
+
+#else
+
+# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
+// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
+using std::basic_ostream;
+template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p)
+# else
+template std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p)
+# endif
+{
+ os << p.get();
+ return os;
+}
+
+#endif
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED
diff --git a/include/boost/scoped_array.hpp b/include/boost/scoped_array.hpp
new file mode 100644
index 0000000..e5919a4
--- /dev/null
+++ b/include/boost/scoped_array.hpp
@@ -0,0 +1,136 @@
+#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED
+#define BOOST_SCOPED_ARRAY_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// http://www.boost.org/libs/smart_ptr/scoped_array.htm
+//
+
+#include
+#include
+#include // in case ptrdiff_t not in std
+
+#include
+
+#include // for std::ptrdiff_t
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_array_constructor_hook(void * p);
+void sp_array_destructor_hook(void * p);
+
+#endif
+
+// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
+// is guaranteed, either on destruction of the scoped_array or via an explicit
+// reset(). Use shared_array or std::vector if your needs are more complex.
+
+template class scoped_array // noncopyable
+{
+private:
+
+ T * ptr;
+
+ scoped_array(scoped_array const &);
+ scoped_array & operator=(scoped_array const &);
+
+ typedef scoped_array this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_array(T * p = 0) : ptr(p) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_constructor_hook(ptr);
+#endif
+ }
+
+ ~scoped_array() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_destructor_hook(ptr);
+#endif
+ boost::checked_array_delete(ptr);
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT(p == 0 || p != ptr); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator[](std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ BOOST_ASSERT(i >= 0);
+ return ptr[i];
+ }
+
+ T * get() const // never throws
+ {
+ return ptr;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return ptr != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::ptr;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return ptr == 0;
+ }
+
+ void swap(scoped_array & b) // never throws
+ {
+ T * tmp = b.ptr;
+ b.ptr = ptr;
+ ptr = tmp;
+ }
+
+};
+
+template inline void swap(scoped_array & a, scoped_array & b) // never throws
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED
diff --git a/include/boost/scoped_ptr.hpp b/include/boost/scoped_ptr.hpp
new file mode 100644
index 0000000..c36cace
--- /dev/null
+++ b/include/boost/scoped_ptr.hpp
@@ -0,0 +1,158 @@
+#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
+#define BOOST_SCOPED_PTR_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
+//
+
+#include
+#include
+#include
+
+#ifndef BOOST_NO_AUTO_PTR
+# include // for std::auto_ptr
+#endif
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_scalar_constructor_hook(void * p);
+void sp_scalar_destructor_hook(void * p);
+
+#endif
+
+// scoped_ptr mimics a built-in pointer except that it guarantees deletion
+// of the object pointed to, either on destruction of the scoped_ptr or via
+// an explicit reset(). scoped_ptr is a simple solution for simple needs;
+// use shared_ptr or std::auto_ptr if your needs are more complex.
+
+template class scoped_ptr // noncopyable
+{
+private:
+
+ T * ptr;
+
+ scoped_ptr(scoped_ptr const &);
+ scoped_ptr & operator=(scoped_ptr const &);
+
+ typedef scoped_ptr this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_ptr(T * p = 0): ptr(p) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook(ptr);
+#endif
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ explicit scoped_ptr(std::auto_ptr p): ptr(p.release()) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook(ptr);
+#endif
+ }
+
+#endif
+
+ ~scoped_ptr() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_destructor_hook(ptr);
+#endif
+ boost::checked_delete(ptr);
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT(p == 0 || p != ptr); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator*() const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ return *ptr;
+ }
+
+ T * operator->() const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ return ptr;
+ }
+
+ T * get() const // never throws
+ {
+ return ptr;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return ptr != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::get;
+ }
+
+#else
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::ptr;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return ptr == 0;
+ }
+
+ void swap(scoped_ptr & b) // never throws
+ {
+ T * tmp = b.ptr;
+ b.ptr = ptr;
+ ptr = tmp;
+ }
+};
+
+template inline void swap(scoped_ptr & a, scoped_ptr & b) // never throws
+{
+ a.swap(b);
+}
+
+// get_pointer(p) is a generic way to say p.get()
+
+template inline T * get_pointer(scoped_ptr const & p)
+{
+ return p.get();
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
diff --git a/include/boost/shared_array.hpp b/include/boost/shared_array.hpp
new file mode 100644
index 0000000..5e943d9
--- /dev/null
+++ b/include/boost/shared_array.hpp
@@ -0,0 +1,176 @@
+#ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED
+#define BOOST_SHARED_ARRAY_HPP_INCLUDED
+
+//
+// shared_array.hpp
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
+//
+
+#include // for broken compiler workarounds
+
+#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+#include
+#else
+
+#include
+#include
+
+#include
+#include
+
+#include // for std::ptrdiff_t
+#include // for std::swap
+#include // for std::less
+
+namespace boost
+{
+
+//
+// shared_array
+//
+// shared_array extends shared_ptr to arrays.
+// The array pointed to is deleted when the last shared_array pointing to it
+// is destroyed or reset.
+//
+
+template class shared_array
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef checked_array_deleter deleter;
+ typedef shared_array this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit shared_array(T * p = 0): px(p), pn(p, deleter())
+ {
+ }
+
+ //
+ // Requirements: D's copy constructor must not throw
+ //
+ // shared_array will release p by calling d(p)
+ //
+
+ template shared_array(T * p, D d): px(p), pn(p, d)
+ {
+ }
+
+// generated copy constructor, assignment, destructor are fine
+
+ void reset(T * p = 0)
+ {
+ BOOST_ASSERT(p == 0 || p != px);
+ this_type(p).swap(*this);
+ }
+
+ template void reset(T * p, D d)
+ {
+ this_type(p, d).swap(*this);
+ }
+
+ T & operator[] (std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ BOOST_ASSERT(i >= 0);
+ return px[i];
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return px != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return px == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return px == 0? 0: &this_type::px;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return px == 0;
+ }
+
+ bool unique() const // never throws
+ {
+ return pn.unique();
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ void swap(shared_array & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+private:
+
+ T * px; // contained pointer
+ detail::shared_count pn; // reference counter
+
+}; // shared_array
+
+template inline bool operator==(shared_array const & a, shared_array const & b) // never throws
+{
+ return a.get() == b.get();
+}
+
+template inline bool operator!=(shared_array const & a, shared_array const & b) // never throws
+{
+ return a.get() != b.get();
+}
+
+template