Include bind in ndnboost.
diff --git a/ndnboost/smart_ptr/detail/shared_array_nmt.hpp b/ndnboost/smart_ptr/detail/shared_array_nmt.hpp
new file mode 100644
index 0000000..4d53afa
--- /dev/null
+++ b/ndnboost/smart_ptr/detail/shared_array_nmt.hpp
@@ -0,0 +1,151 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
+
+//
+// detail/shared_array_nmt.hpp - shared_array.hpp without member templates
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
+//
+
+#include <ndnboost/assert.hpp>
+#include <ndnboost/checked_delete.hpp>
+#include <ndnboost/throw_exception.hpp>
+#include <ndnboost/smart_ptr/detail/atomic_count.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+#include <algorithm> // for std::swap
+#include <functional> // for std::less
+#include <new> // for std::bad_alloc
+
+namespace ndnboost
+{
+
+template<class T> class shared_array
+{
+private:
+
+ typedef detail::atomic_count count_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit shared_array(T * p = 0): px(p)
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try // prevent leak if new throws
+ {
+ pn = new count_type(1);
+ }
+ catch(...)
+ {
+ ndnboost::checked_array_delete(p);
+ throw;
+ }
+
+#else
+
+ pn = new count_type(1);
+
+ if(pn == 0)
+ {
+ ndnboost::checked_array_delete(p);
+ ndnboost::throw_exception(std::bad_alloc());
+ }
+
+#endif
+ }
+
+ ~shared_array()
+ {
+ if(--*pn == 0)
+ {
+ ndnboost::checked_array_delete(px);
+ delete pn;
+ }
+ }
+
+ shared_array(shared_array const & r) : px(r.px) // never throws
+ {
+ pn = r.pn;
+ ++*pn;
+ }
+
+ shared_array & operator=(shared_array const & r)
+ {
+ shared_array(r).swap(*this);
+ return *this;
+ }
+
+ void reset(T * p = 0)
+ {
+ BOOST_ASSERT(p == 0 || p != px);
+ shared_array(p).swap(*this);
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+ T & operator[](std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ BOOST_ASSERT(i >= 0);
+ return px[i];
+ }
+
+ long use_count() const // never throws
+ {
+ return *pn;
+ }
+
+ bool unique() const // never throws
+ {
+ return *pn == 1;
+ }
+
+ void swap(shared_array<T> & 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
+
+}; // shared_array
+
+template<class T, class U> inline bool operator==(shared_array<T> const & a, shared_array<U> const & b)
+{
+ return a.get() == b.get();
+}
+
+template<class T, class U> inline bool operator!=(shared_array<T> const & a, shared_array<U> const & b)
+{
+ return a.get() != b.get();
+}
+
+template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b)
+{
+ return std::less<T*>()(a.get(), b.get());
+}
+
+template<class T> void swap(shared_array<T> & a, shared_array<T> & b)
+{
+ a.swap(b);
+}
+
+} // namespace ndnboost
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
diff --git a/ndnboost/smart_ptr/scoped_array.hpp b/ndnboost/smart_ptr/scoped_array.hpp
new file mode 100644
index 0000000..7584d27
--- /dev/null
+++ b/ndnboost/smart_ptr/scoped_array.hpp
@@ -0,0 +1,132 @@
+#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
+#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_array.htm
+//
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/assert.hpp>
+#include <ndnboost/checked_delete.hpp>
+#include <ndnboost/smart_ptr/detail/sp_nullptr_t.hpp>
+
+#include <ndnboost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+
+namespace ndnboost
+{
+
+// 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 T> class scoped_array // noncopyable
+{
+private:
+
+ T * px;
+
+ scoped_array(scoped_array const &);
+ scoped_array & operator=(scoped_array const &);
+
+ typedef scoped_array<T> this_type;
+
+ void operator==( scoped_array const& ) const;
+ void operator!=( scoped_array const& ) const;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p )
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ ndnboost::sp_array_constructor_hook( px );
+#endif
+ }
+
+ ~scoped_array() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ ndnboost::sp_array_destructor_hook( px );
+#endif
+ ndnboost::checked_array_delete( px );
+ }
+
+ void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ {
+ BOOST_ASSERT( px != 0 );
+ BOOST_ASSERT( i >= 0 );
+ return px[i];
+ }
+
+ T * get() const BOOST_NOEXCEPT
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <ndnboost/smart_ptr/detail/operator_bool.hpp>
+
+ void swap(scoped_array & b) BOOST_NOEXCEPT
+ {
+ T * tmp = b.px;
+ b.px = px;
+ px = tmp;
+ }
+};
+
+#if !defined( BOOST_NO_CXX11_NULLPTR )
+
+template<class T> inline bool operator==( scoped_array<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator==( ndnboost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator!=( scoped_array<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+template<class T> inline bool operator!=( ndnboost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+#endif
+
+template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_NOEXCEPT
+{
+ a.swap(b);
+}
+
+} // namespace ndnboost
+
+#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
diff --git a/ndnboost/smart_ptr/scoped_ptr.hpp b/ndnboost/smart_ptr/scoped_ptr.hpp
new file mode 100644
index 0000000..7ee252b
--- /dev/null
+++ b/ndnboost/smart_ptr/scoped_ptr.hpp
@@ -0,0 +1,157 @@
+#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
+#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
+//
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/assert.hpp>
+#include <ndnboost/checked_delete.hpp>
+#include <ndnboost/smart_ptr/detail/sp_nullptr_t.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+#ifndef BOOST_NO_AUTO_PTR
+# include <memory> // for std::auto_ptr
+#endif
+
+namespace ndnboost
+{
+
+// 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 T> class scoped_ptr // noncopyable
+{
+private:
+
+ T * px;
+
+ scoped_ptr(scoped_ptr const &);
+ scoped_ptr & operator=(scoped_ptr const &);
+
+ typedef scoped_ptr<T> this_type;
+
+ void operator==( scoped_ptr const& ) const;
+ void operator!=( scoped_ptr const& ) const;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_ptr( T * p = 0 ): px( p ) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ ndnboost::sp_scalar_constructor_hook( px );
+#endif
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_NOEXCEPT : px( p.release() )
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ ndnboost::sp_scalar_constructor_hook( px );
+#endif
+ }
+
+#endif
+
+ ~scoped_ptr() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ ndnboost::sp_scalar_destructor_hook( px );
+#endif
+ ndnboost::checked_delete( px );
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
+ this_type(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 BOOST_NOEXCEPT
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <ndnboost/smart_ptr/detail/operator_bool.hpp>
+
+ void swap(scoped_ptr & b) BOOST_NOEXCEPT
+ {
+ T * tmp = b.px;
+ b.px = px;
+ px = tmp;
+ }
+};
+
+#if !defined( BOOST_NO_CXX11_NULLPTR )
+
+template<class T> inline bool operator==( scoped_ptr<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator==( ndnboost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator!=( scoped_ptr<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+template<class T> inline bool operator!=( ndnboost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+#endif
+
+template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_NOEXCEPT
+{
+ a.swap(b);
+}
+
+// get_pointer(p) is a generic way to say p.get()
+
+template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_NOEXCEPT
+{
+ return p.get();
+}
+
+} // namespace ndnboost
+
+#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
diff --git a/ndnboost/smart_ptr/shared_array.hpp b/ndnboost/smart_ptr/shared_array.hpp
new file mode 100644
index 0000000..e5626f7
--- /dev/null
+++ b/ndnboost/smart_ptr/shared_array.hpp
@@ -0,0 +1,290 @@
+#ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED
+#define BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED
+
+//
+// shared_array.hpp
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002, 2012 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
+//
+
+#include <ndnboost/config.hpp> // for broken compiler workarounds
+
+#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+#include <ndnboost/smart_ptr/detail/shared_array_nmt.hpp>
+#else
+
+#include <memory> // TR1 cyclic inclusion fix
+
+#include <ndnboost/assert.hpp>
+#include <ndnboost/checked_delete.hpp>
+
+#include <ndnboost/smart_ptr/shared_ptr.hpp>
+#include <ndnboost/smart_ptr/detail/shared_count.hpp>
+#include <ndnboost/smart_ptr/detail/sp_nullptr_t.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+#include <algorithm> // for std::swap
+#include <functional> // for std::less
+
+namespace ndnboost
+{
+
+//
+// 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 T> class shared_array
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef checked_array_deleter<T> deleter;
+ typedef shared_array<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ shared_array() BOOST_NOEXCEPT : px( 0 ), pn()
+ {
+ }
+
+ template<class Y>
+ explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter<Y>() )
+ {
+ ndnboost::detail::sp_assert_convertible< Y[], T[] >();
+ }
+
+ //
+ // Requirements: D's copy constructor must not throw
+ //
+ // shared_array will release p by calling d(p)
+ //
+
+ template<class Y, class D> shared_array( Y * p, D d ): px( p ), pn( p, d )
+ {
+ ndnboost::detail::sp_assert_convertible< Y[], T[] >();
+ }
+
+ // As above, but with allocator. A's copy constructor shall not throw.
+
+ template<class Y, class D, class A> shared_array( Y * p, D d, A a ): px( p ), pn( p, d, a )
+ {
+ ndnboost::detail::sp_assert_convertible< Y[], T[] >();
+ }
+
+// generated copy constructor, destructor are fine...
+
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+
+// ... except in C++0x, move disables the implicit copy
+
+ shared_array( shared_array const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
+ {
+ }
+
+ shared_array( shared_array && r ) BOOST_NOEXCEPT : px( r.px ), pn()
+ {
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+
+#endif
+
+ // conversion
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ shared_array( shared_array<Y> const & r, typename ndnboost::detail::sp_enable_if_convertible< Y[], T[] >::type = ndnboost::detail::sp_empty() )
+
+#else
+
+ shared_array( shared_array<Y> const & r )
+
+#endif
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) // never throws
+ {
+ ndnboost::detail::sp_assert_convertible< Y[], T[] >();
+ }
+
+ // aliasing
+
+ template< class Y >
+ shared_array( shared_array<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
+ {
+ }
+
+ // assignment
+
+ shared_array & operator=( shared_array const & r ) BOOST_NOEXCEPT
+ {
+ this_type( r ).swap( *this );
+ return *this;
+ }
+
+#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
+
+ template<class Y>
+ shared_array & operator=( shared_array<Y> const & r ) BOOST_NOEXCEPT
+ {
+ this_type( r ).swap( *this );
+ return *this;
+ }
+
+#endif
+
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+
+ shared_array & operator=( shared_array && r ) BOOST_NOEXCEPT
+ {
+ this_type( static_cast< shared_array && >( r ) ).swap( *this );
+ return *this;
+ }
+
+ template<class Y>
+ shared_array & operator=( shared_array<Y> && r ) BOOST_NOEXCEPT
+ {
+ this_type( static_cast< shared_array<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+
+#endif
+
+ void reset() BOOST_NOEXCEPT
+ {
+ this_type().swap( *this );
+ }
+
+ template<class Y> void reset( Y * p ) // Y must be complete
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
+ this_type( p ).swap( *this );
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_array<Y> const & r, element_type * p )
+ {
+ this_type( r, p ).swap( *this );
+ }
+
+ T & operator[] (std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ {
+ BOOST_ASSERT(px != 0);
+ BOOST_ASSERT(i >= 0);
+ return px[i];
+ }
+
+ T * get() const BOOST_NOEXCEPT
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <ndnboost/smart_ptr/detail/operator_bool.hpp>
+
+ bool unique() const BOOST_NOEXCEPT
+ {
+ return pn.unique();
+ }
+
+ long use_count() const BOOST_NOEXCEPT
+ {
+ return pn.use_count();
+ }
+
+ void swap(shared_array<T> & other) BOOST_NOEXCEPT
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+ void * _internal_get_deleter( ndnboost::detail::sp_typeinfo const & ti ) const
+ {
+ return pn.get_deleter( ti );
+ }
+
+private:
+
+ template<class Y> friend class shared_array;
+
+ T * px; // contained pointer
+ detail::shared_count pn; // reference counter
+
+}; // shared_array
+
+template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
+{
+ return a.get() == b.get();
+}
+
+template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
+{
+ return a.get() != b.get();
+}
+
+#if !defined( BOOST_NO_CXX11_NULLPTR )
+
+template<class T> inline bool operator==( shared_array<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator==( ndnboost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator!=( shared_array<T> const & p, ndnboost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+template<class T> inline bool operator!=( ndnboost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+#endif
+
+template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
+{
+ return std::less<T*>()(a.get(), b.get());
+}
+
+template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_NOEXCEPT
+{
+ a.swap(b);
+}
+
+template< class D, class T > D * get_deleter( shared_array<T> const & p )
+{
+ return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) );
+}
+
+} // namespace ndnboost
+
+#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+#endif // #ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED