In common.h, define func_lib for function objects. In configure.ac, define HAVE_STD_FUNCTION and HAVE_BOOST_FUNCTION. Include function headers in ndnboost.
diff --git a/ndnboost/detail/call_traits.hpp b/ndnboost/detail/call_traits.hpp
new file mode 100644
index 0000000..0a2cdb2
--- /dev/null
+++ b/ndnboost/detail/call_traits.hpp
@@ -0,0 +1,172 @@
+// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
+// Use, modification and distribution are subject to 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/utility for most recent version including documentation.
+
+// call_traits: defines typedefs for function usage
+// (see libs/utility/call_traits.htm)
+
+/* Release notes:
+ 23rd July 2000:
+ Fixed array specialization. (JM)
+ Added Borland specific fixes for reference types
+ (issue raised by Steve Cleary).
+*/
+
+#ifndef BOOST_DETAIL_CALL_TRAITS_HPP
+#define BOOST_DETAIL_CALL_TRAITS_HPP
+
+#ifndef BOOST_CONFIG_HPP
+#include <ndnboost/config.hpp>
+#endif
+#include <cstddef>
+
+#include <ndnboost/type_traits/is_arithmetic.hpp>
+#include <ndnboost/type_traits/is_enum.hpp>
+#include <ndnboost/type_traits/is_pointer.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+namespace ndnboost{
+
+namespace detail{
+
+template <typename T, bool small_>
+struct ct_imp2
+{
+ typedef const T& param_type;
+};
+
+template <typename T>
+struct ct_imp2<T, true>
+{
+ typedef const T param_type;
+};
+
+template <typename T, bool isp, bool b1, bool b2>
+struct ct_imp
+{
+ typedef const T& param_type;
+};
+
+template <typename T, bool isp, bool b2>
+struct ct_imp<T, isp, true, b2>
+{
+ typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
+};
+
+template <typename T, bool isp, bool b1>
+struct ct_imp<T, isp, b1, true>
+{
+ typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
+};
+
+template <typename T, bool b1, bool b2>
+struct ct_imp<T, true, b1, b2>
+{
+ typedef const T param_type;
+};
+
+}
+
+template <typename T>
+struct call_traits
+{
+public:
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ //
+ // C++ Builder workaround: we should be able to define a compile time
+ // constant and pass that as a single template parameter to ct_imp<T,bool>,
+ // however compiler bugs prevent this - instead pass three bool's to
+ // ct_imp<T,bool,bool,bool> and add an extra partial specialisation
+ // of ct_imp to handle the logic. (JM)
+ typedef typename ndnboost::detail::ct_imp<
+ T,
+ ::ndnboost::is_pointer<T>::value,
+ ::ndnboost::is_arithmetic<T>::value,
+ ::ndnboost::is_enum<T>::value
+ >::param_type param_type;
+};
+
+template <typename T>
+struct call_traits<T&>
+{
+ typedef T& value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T& param_type; // hh removed const
+};
+
+#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 )
+// these are illegal specialisations; cv-qualifies applied to
+// references have no effect according to [8.3.2p1],
+// C++ Builder requires them though as it treats cv-qualified
+// references as distinct types...
+template <typename T>
+struct call_traits<T&const>
+{
+ typedef T& value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T& param_type; // hh removed const
+};
+template <typename T>
+struct call_traits<T&volatile>
+{
+ typedef T& value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T& param_type; // hh removed const
+};
+template <typename T>
+struct call_traits<T&const volatile>
+{
+ typedef T& value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T& param_type; // hh removed const
+};
+
+template <typename T>
+struct call_traits< T * >
+{
+ typedef T * value_type;
+ typedef T * & reference;
+ typedef T * const & const_reference;
+ typedef T * const param_type; // hh removed const
+};
+#endif
+#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
+template <typename T, std::size_t N>
+struct call_traits<T [N]>
+{
+private:
+ typedef T array_type[N];
+public:
+ // degrades array to pointer:
+ typedef const T* value_type;
+ typedef array_type& reference;
+ typedef const array_type& const_reference;
+ typedef const T* const param_type;
+};
+
+template <typename T, std::size_t N>
+struct call_traits<const T [N]>
+{
+private:
+ typedef const T array_type[N];
+public:
+ // degrades array to pointer:
+ typedef const T* value_type;
+ typedef array_type& reference;
+ typedef const array_type& const_reference;
+ typedef const T* const param_type;
+};
+#endif
+
+}
+
+#endif // BOOST_DETAIL_CALL_TRAITS_HPP
diff --git a/ndnboost/detail/container_fwd.hpp b/ndnboost/detail/container_fwd.hpp
new file mode 100644
index 0000000..0254e7b
--- /dev/null
+++ b/ndnboost/detail/container_fwd.hpp
@@ -0,0 +1,162 @@
+
+// Copyright 2005-2011 Daniel James.
+// 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)
+
+// Note: if you change this include guard, you also need to change
+// container_fwd_compile_fail.cpp
+#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP)
+#define BOOST_DETAIL_CONTAINER_FWD_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \
+ !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
+# pragma once
+#endif
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+////////////////////////////////////////////////////////////////////////////////
+// //
+// Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to //
+// forward declare standard containers. //
+// //
+// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it //
+// normally doesn't. //
+// //
+// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD. //
+// //
+////////////////////////////////////////////////////////////////////////////////
+
+#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
+# if defined(BOOST_DETAIL_CONTAINER_FWD)
+ // Force forward declarations.
+# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+ // STLport
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif defined(__LIBCOMO__)
+ // Comeau STL:
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
+ // Rogue Wave library:
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif defined(_LIBCPP_VERSION)
+ // libc++
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+ // GNU libstdc++ 3
+ //
+ // Disable forwarding for all recent versions, as the library has a
+ // versioned namespace mode, and I don't know how to detect it.
+# if __GLIBCXX__ >= 20070513 \
+ || defined(_GLIBCXX_DEBUG) \
+ || defined(_GLIBCXX_PARALLEL) \
+ || defined(_GLIBCXX_PROFILE)
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# else
+# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20040530
+# define BOOST_CONTAINER_FWD_COMPLEX_STRUCT
+# endif
+# endif
+# elif defined(__STL_CONFIG_H)
+ // generic SGI STL
+ //
+ // Forward declaration seems to be okay, but it has a couple of odd
+ // implementations.
+# define BOOST_CONTAINER_FWD_BAD_BITSET
+# if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
+# define BOOST_CONTAINER_FWD_BAD_DEQUE
+# endif
+# elif defined(__MSL_CPP__)
+ // MSL standard lib:
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif defined(__IBMCPP__)
+ // The default VACPP std lib, forward declaration seems to be fine.
+# elif defined(MSIPL_COMPILE_H)
+ // Modena C++ standard library
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+ // Dinkumware Library (this has to appear after any possible replacement
+ // libraries)
+# else
+# define BOOST_DETAIL_NO_CONTAINER_FWD
+# endif
+#endif
+
+#if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
+
+#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \
+ !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD)
+
+#include <deque>
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+#include <bitset>
+#include <string>
+#include <complex>
+
+#else
+
+#include <cstddef>
+
+#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
+#include <deque>
+#endif
+
+#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
+#include <bitset>
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
+#endif
+
+namespace std
+{
+ template <class T> class allocator;
+ template <class charT, class traits, class Allocator> class basic_string;
+
+#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+
+ template <class charT> struct string_char_traits;
+#else
+ template <class charT> struct char_traits;
+#endif
+
+#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT)
+ template <class T> struct complex;
+#else
+ template <class T> class complex;
+#endif
+
+#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
+ template <class T, class Allocator> class deque;
+#endif
+
+ template <class T, class Allocator> class list;
+ template <class T, class Allocator> class vector;
+ template <class Key, class T, class Compare, class Allocator> class map;
+ template <class Key, class T, class Compare, class Allocator>
+ class multimap;
+ template <class Key, class Compare, class Allocator> class set;
+ template <class Key, class Compare, class Allocator> class multiset;
+
+#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
+ template <size_t N> class bitset;
+#endif
+ template <class T1, class T2> struct pair;
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_DETAIL_NO_CONTAINER_FWD &&
+ // !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD)
+
+#endif // BOOST_DETAIL_TEST_CONFIG_ONLY
+
+#endif
diff --git a/ndnboost/detail/is_incrementable.hpp b/ndnboost/detail/is_incrementable.hpp
new file mode 100644
index 0000000..a15ccb6
--- /dev/null
+++ b/ndnboost/detail/is_incrementable.hpp
@@ -0,0 +1,134 @@
+// Copyright David Abrahams 2004. Use, modification and distribution is
+// subject to 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)
+#ifndef IS_INCREMENTABLE_DWA200415_HPP
+# define IS_INCREMENTABLE_DWA200415_HPP
+
+# include <ndnboost/type_traits/detail/template_arity_spec.hpp>
+# include <ndnboost/type_traits/remove_cv.hpp>
+# include <ndnboost/mpl/aux_/lambda_support.hpp>
+# include <ndnboost/mpl/bool.hpp>
+# include <ndnboost/detail/workaround.hpp>
+
+// Must be the last include
+# include <ndnboost/type_traits/detail/bool_trait_def.hpp>
+
+namespace ndnboost { namespace detail {
+
+// is_incrementable<T> metafunction
+//
+// Requires: Given x of type T&, if the expression ++x is well-formed
+// it must have complete type; otherwise, it must neither be ambiguous
+// nor violate access.
+
+// This namespace ensures that ADL doesn't mess things up.
+namespace is_incrementable_
+{
+ // a type returned from operator++ when no increment is found in the
+ // type's own namespace
+ struct tag {};
+
+ // any soaks up implicit conversions and makes the following
+ // operator++ less-preferred than any other such operator that
+ // might be found via ADL.
+ struct any { template <class T> any(T const&); };
+
+ // This is a last-resort operator++ for when none other is found
+# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
+
+}
+
+namespace is_incrementable_2
+{
+ is_incrementable_::tag operator++(is_incrementable_::any const&);
+ is_incrementable_::tag operator++(is_incrementable_::any const&,int);
+}
+using namespace is_incrementable_2;
+
+namespace is_incrementable_
+{
+
+# else
+
+ tag operator++(any const&);
+ tag operator++(any const&,int);
+
+# endif
+
+# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
+ || BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+# define BOOST_comma(a,b) (a)
+# else
+ // In case an operator++ is found that returns void, we'll use ++x,0
+ tag operator,(tag,int);
+# define BOOST_comma(a,b) (a,b)
+# endif
+
+# if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable:4913) // Warning about operator,
+# endif
+
+ // two check overloads help us identify which operator++ was picked
+ char (& check_(tag) )[2];
+
+ template <class T>
+ char check_(T const&);
+
+
+ template <class T>
+ struct impl
+ {
+ static typename ndnboost::remove_cv<T>::type& x;
+
+ BOOST_STATIC_CONSTANT(
+ bool
+ , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
+ );
+ };
+
+ template <class T>
+ struct postfix_impl
+ {
+ static typename ndnboost::remove_cv<T>::type& x;
+
+ BOOST_STATIC_CONSTANT(
+ bool
+ , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
+ );
+ };
+
+# if defined(BOOST_MSVC)
+# pragma warning(pop)
+# endif
+
+}
+
+# undef BOOST_comma
+
+template<typename T>
+struct is_incrementable
+BOOST_TT_AUX_BOOL_C_BASE(::ndnboost::detail::is_incrementable_::impl<T>::value)
+{
+ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::ndnboost::detail::is_incrementable_::impl<T>::value)
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
+};
+
+template<typename T>
+struct is_postfix_incrementable
+BOOST_TT_AUX_BOOL_C_BASE(::ndnboost::detail::is_incrementable_::impl<T>::value)
+{
+ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::ndnboost::detail::is_incrementable_::postfix_impl<T>::value)
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
+};
+
+} // namespace detail
+
+BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::ndnboost::detail::is_incrementable)
+BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::ndnboost::detail::is_postfix_incrementable)
+
+} // namespace ndnboost
+
+# include <ndnboost/type_traits/detail/bool_trait_undef.hpp>
+
+#endif // IS_INCREMENTABLE_DWA200415_HPP
diff --git a/ndnboost/detail/iterator.hpp b/ndnboost/detail/iterator.hpp
new file mode 100644
index 0000000..6cfb5aa
--- /dev/null
+++ b/ndnboost/detail/iterator.hpp
@@ -0,0 +1,494 @@
+// (C) Copyright David Abrahams 2002.
+// 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)
+
+// Boost versions of
+//
+// std::iterator_traits<>::iterator_category
+// std::iterator_traits<>::difference_type
+// std::distance()
+//
+// ...for all compilers and iterators
+//
+// Additionally, if X is a pointer
+// std::iterator_traits<X>::pointer
+
+// Otherwise, if partial specialization is supported or X is not a pointer
+// std::iterator_traits<X>::value_type
+// std::iterator_traits<X>::pointer
+// std::iterator_traits<X>::reference
+//
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams)
+// 03 Mar 2001 - Put all implementation into namespace
+// ndnboost::detail::iterator_traits_. Some progress made on fixes
+// for Intel compiler. (David Abrahams)
+// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few
+// places. (Jeremy Siek)
+// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and
+// no_type from type_traits.hpp; stopped trying to remove_cv
+// before detecting is_pointer, in honor of the new type_traits
+// semantics. (David Abrahams)
+// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators
+// under raw VC6. The one category remaining which will fail is
+// that of iterators derived from std::iterator but not
+// ndnboost::iterator and which redefine difference_type.
+// 11 Feb 2001 - Clean away code which can never be used (David Abrahams)
+// 09 Feb 2001 - Always have a definition for each traits member, even if it
+// can't be properly deduced. These will be incomplete types in
+// some cases (undefined<void>), but it helps suppress MSVC errors
+// elsewhere (David Abrahams)
+// 07 Feb 2001 - Support for more of the traits members where possible, making
+// this useful as a replacement for std::iterator_traits<T> when
+// used as a default template parameter.
+// 06 Feb 2001 - Removed useless #includes of standard library headers
+// (David Abrahams)
+
+#ifndef ITERATOR_DWA122600_HPP_
+# define ITERATOR_DWA122600_HPP_
+
+# include <ndnboost/config.hpp>
+# include <iterator>
+
+// STLPort 4.0 and betas have a bug when debugging is enabled and there is no
+// partial specialization: instead of an iterator_category typedef, the standard
+// container iterators have _Iterator_category.
+//
+// Also, whether debugging is enabled or not, there is a broken specialization
+// of std::iterator<output_iterator_tag,void,void,void,void> which has no
+// typedefs but iterator_category.
+# if defined(__SGI_STL_PORT)
+
+# if (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && defined(__STL_DEBUG)
+# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+# endif
+
+# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
+
+# endif // STLPort <= 4.1b4 && no partial specialization
+
+# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \
+ && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ && !defined(BOOST_MSVC_STD_ITERATOR)
+
+namespace ndnboost { namespace detail {
+
+// Define a new template so it can be specialized
+template <class Iterator>
+struct iterator_traits
+ : std::iterator_traits<Iterator>
+{};
+using std::distance;
+
+}} // namespace ndnboost::detail
+
+# else
+
+# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ && !defined(BOOST_MSVC_STD_ITERATOR)
+
+// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS
+
+namespace ndnboost { namespace detail {
+
+// Rogue Wave Standard Library fools itself into thinking partial
+// specialization is missing on some platforms (e.g. Sun), so fails to
+// supply iterator_traits!
+template <class Iterator>
+struct iterator_traits
+{
+ typedef typename Iterator::value_type value_type;
+ typedef typename Iterator::reference reference;
+ typedef typename Iterator::pointer pointer;
+ typedef typename Iterator::difference_type difference_type;
+ typedef typename Iterator::iterator_category iterator_category;
+};
+
+template <class T>
+struct iterator_traits<T*>
+{
+ typedef T value_type;
+ typedef T& reference;
+ typedef T* pointer;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::random_access_iterator_tag iterator_category;
+};
+
+template <class T>
+struct iterator_traits<T const*>
+{
+ typedef T value_type;
+ typedef T const& reference;
+ typedef T const* pointer;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::random_access_iterator_tag iterator_category;
+};
+
+}} // namespace ndnboost::detail
+
+# else
+
+# include <ndnboost/type_traits/remove_const.hpp>
+# include <ndnboost/type_traits/detail/yes_no_type.hpp>
+# include <ndnboost/type_traits/is_pointer.hpp>
+
+# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+# include <ndnboost/type_traits/is_same.hpp>
+# include <ndnboost/type_traits/remove_pointer.hpp>
+# endif
+# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
+# include <ndnboost/type_traits/is_base_and_derived.hpp>
+# endif
+
+# include <ndnboost/mpl/if.hpp>
+# include <ndnboost/mpl/has_xxx.hpp>
+# include <cstddef>
+
+// should be the last #include
+# include "ndnboost/type_traits/detail/bool_trait_def.hpp"
+
+namespace ndnboost { namespace detail {
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
+
+// is_mutable_iterator --
+//
+// A metafunction returning true iff T is a mutable iterator type
+// with a nested value_type. Will only work portably with iterators
+// whose operator* returns a reference, but that seems to be OK for
+// the iterators supplied by Dinkumware. Some input iterators may
+// compile-time if they arrive here, and if the compiler is strict
+// about not taking the address of an rvalue.
+
+// This one detects ordinary mutable iterators - the result of
+// operator* is convertible to the value_type.
+template <class T>
+type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*);
+
+// Since you can't take the address of an rvalue, the guts of
+// is_mutable_iterator_impl will fail if we use &*t directly. This
+// makes sure we can still work with non-lvalue iterators.
+template <class T> T* mutable_iterator_lvalue_helper(T& x);
+int mutable_iterator_lvalue_helper(...);
+
+
+// This one detects output iterators such as ostream_iterator which
+// return references to themselves.
+template <class T>
+type_traits::yes_type is_mutable_iterator_helper(T const*, T const*);
+
+type_traits::no_type is_mutable_iterator_helper(...);
+
+template <class T>
+struct is_mutable_iterator_impl
+{
+ static T t;
+
+ BOOST_STATIC_CONSTANT(
+ bool, value = sizeof(
+ detail::is_mutable_iterator_helper(
+ (T*)0
+ , mutable_iterator_lvalue_helper(*t) // like &*t
+ ))
+ == sizeof(type_traits::yes_type)
+ );
+};
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(
+ is_mutable_iterator,T,::ndnboost::detail::is_mutable_iterator_impl<T>::value)
+
+
+// is_full_iterator_traits --
+//
+// A metafunction returning true iff T has all the requisite nested
+// types to satisfy the requirements for a fully-conforming
+// iterator_traits implementation.
+template <class T>
+struct is_full_iterator_traits_impl
+{
+ enum { value =
+ has_value_type<T>::value
+ & has_reference<T>::value
+ & has_pointer<T>::value
+ & has_difference_type<T>::value
+ & has_iterator_category<T>::value
+ };
+};
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(
+ is_full_iterator_traits,T,::ndnboost::detail::is_full_iterator_traits_impl<T>::value)
+
+
+# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category)
+
+// is_stlport_40_debug_iterator --
+//
+// A metafunction returning true iff T has all the requisite nested
+// types to satisfy the requirements of an STLPort 4.0 debug iterator
+// iterator_traits implementation.
+template <class T>
+struct is_stlport_40_debug_iterator_impl
+{
+ enum { value =
+ has_value_type<T>::value
+ & has_reference<T>::value
+ & has_pointer<T>::value
+ & has_difference_type<T>::value
+ & has__Iterator_category<T>::value
+ };
+};
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(
+ is_stlport_40_debug_iterator,T,::ndnboost::detail::is_stlport_40_debug_iterator_impl<T>::value)
+
+template <class T>
+struct stlport_40_debug_iterator_traits
+{
+ typedef typename T::value_type value_type;
+ typedef typename T::reference reference;
+ typedef typename T::pointer pointer;
+ typedef typename T::difference_type difference_type;
+ typedef typename T::_Iterator_category iterator_category;
+};
+# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+
+template <class T> struct pointer_iterator_traits;
+
+# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template <class T>
+struct pointer_iterator_traits<T*>
+{
+ typedef typename remove_const<T>::type value_type;
+ typedef T* pointer;
+ typedef T& reference;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef std::ptrdiff_t difference_type;
+};
+# else
+
+// In case of no template partial specialization, and if T is a
+// pointer, iterator_traits<T>::value_type can still be computed. For
+// some basic types, remove_pointer is manually defined in
+// type_traits/broken_compiler_spec.hpp. For others, do it yourself.
+
+template<class P> class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee;
+
+template<class P>
+struct pointer_value_type
+ : mpl::if_<
+ is_same<P, typename remove_pointer<P>::type>
+ , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
+ , typename remove_const<
+ typename remove_pointer<P>::type
+ >::type
+ >
+{
+};
+
+
+template<class P>
+struct pointer_reference
+ : mpl::if_<
+ is_same<P, typename remove_pointer<P>::type>
+ , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
+ , typename remove_pointer<P>::type&
+ >
+{
+};
+
+template <class T>
+struct pointer_iterator_traits
+{
+ typedef T pointer;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef std::ptrdiff_t difference_type;
+
+ typedef typename pointer_value_type<T>::type value_type;
+ typedef typename pointer_reference<T>::type reference;
+};
+
+# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+// We'll sort iterator types into one of these classifications, from which we
+// can determine the difference_type, pointer, reference, and value_type
+template <class Iterator>
+struct standard_iterator_traits
+{
+ typedef typename Iterator::difference_type difference_type;
+ typedef typename Iterator::value_type value_type;
+ typedef typename Iterator::pointer pointer;
+ typedef typename Iterator::reference reference;
+ typedef typename Iterator::iterator_category iterator_category;
+};
+
+template <class Iterator>
+struct msvc_stdlib_mutable_traits
+ : std::iterator_traits<Iterator>
+{
+ typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
+ typedef typename std::iterator_traits<Iterator>::value_type* pointer;
+ typedef typename std::iterator_traits<Iterator>::value_type& reference;
+};
+
+template <class Iterator>
+struct msvc_stdlib_const_traits
+ : std::iterator_traits<Iterator>
+{
+ typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
+ typedef const typename std::iterator_traits<Iterator>::value_type* pointer;
+ typedef const typename std::iterator_traits<Iterator>::value_type& reference;
+};
+
+# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
+template <class Iterator>
+struct is_bad_output_iterator
+ : is_base_and_derived<
+ std::iterator<std::output_iterator_tag,void,void,void,void>
+ , Iterator>
+{
+};
+
+struct bad_output_iterator_traits
+{
+ typedef void value_type;
+ typedef void difference_type;
+ typedef std::output_iterator_tag iterator_category;
+ typedef void pointer;
+ typedef void reference;
+};
+# endif
+
+// If we're looking at an MSVC6 (old Dinkumware) ``standard''
+// iterator, this will generate an appropriate traits class.
+template <class Iterator>
+struct msvc_stdlib_iterator_traits
+ : mpl::if_<
+ is_mutable_iterator<Iterator>
+ , msvc_stdlib_mutable_traits<Iterator>
+ , msvc_stdlib_const_traits<Iterator>
+ >::type
+{};
+
+template <class Iterator>
+struct non_pointer_iterator_traits
+ : mpl::if_<
+ // if the iterator contains all the right nested types...
+ is_full_iterator_traits<Iterator>
+ // Use a standard iterator_traits implementation
+ , standard_iterator_traits<Iterator>
+# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+ // Check for STLPort 4.0 broken _Iterator_category type
+ , mpl::if_<
+ is_stlport_40_debug_iterator<Iterator>
+ , stlport_40_debug_iterator_traits<Iterator>
+# endif
+ // Otherwise, assume it's a Dinkum iterator
+ , msvc_stdlib_iterator_traits<Iterator>
+# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+ >::type
+# endif
+ >::type
+{
+};
+
+template <class Iterator>
+struct iterator_traits_aux
+ : mpl::if_<
+ is_pointer<Iterator>
+ , pointer_iterator_traits<Iterator>
+ , non_pointer_iterator_traits<Iterator>
+ >::type
+{
+};
+
+template <class Iterator>
+struct iterator_traits
+{
+ // Explicit forwarding from base class needed to keep MSVC6 happy
+ // under some circumstances.
+ private:
+# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
+ typedef
+ typename mpl::if_<
+ is_bad_output_iterator<Iterator>
+ , bad_output_iterator_traits
+ , iterator_traits_aux<Iterator>
+ >::type base;
+# else
+ typedef iterator_traits_aux<Iterator> base;
+# endif
+ public:
+ typedef typename base::value_type value_type;
+ typedef typename base::pointer pointer;
+ typedef typename base::reference reference;
+ typedef typename base::difference_type difference_type;
+ typedef typename base::iterator_category iterator_category;
+};
+
+// This specialization cuts off ETI (Early Template Instantiation) for MSVC.
+template <> struct iterator_traits<int>
+{
+ typedef int value_type;
+ typedef int pointer;
+ typedef int reference;
+ typedef int difference_type;
+ typedef int iterator_category;
+};
+
+}} // namespace ndnboost::detail
+
+# endif // workarounds
+
+namespace ndnboost { namespace detail {
+
+namespace iterator_traits_
+{
+ template <class Iterator, class Difference>
+ struct distance_select
+ {
+ static Difference execute(Iterator i1, const Iterator i2, ...)
+ {
+ Difference result = 0;
+ while (i1 != i2)
+ {
+ ++i1;
+ ++result;
+ }
+ return result;
+ }
+
+ static Difference execute(Iterator i1, const Iterator i2, std::random_access_iterator_tag*)
+ {
+ return i2 - i1;
+ }
+ };
+} // namespace ndnboost::detail::iterator_traits_
+
+template <class Iterator>
+inline typename iterator_traits<Iterator>::difference_type
+distance(Iterator first, Iterator last)
+{
+ typedef typename iterator_traits<Iterator>::difference_type diff_t;
+ typedef typename ::ndnboost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
+
+ return iterator_traits_::distance_select<Iterator,diff_t>::execute(
+ first, last, (iterator_category*)0);
+}
+
+}}
+
+# endif
+
+
+# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
+# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
+
+#endif // ITERATOR_DWA122600_HPP_
diff --git a/ndnboost/detail/lightweight_mutex.hpp b/ndnboost/detail/lightweight_mutex.hpp
new file mode 100644
index 0000000..6b952e5
--- /dev/null
+++ b/ndnboost/detail/lightweight_mutex.hpp
@@ -0,0 +1,22 @@
+#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
+#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// boost/detail/lightweight_mutex.hpp - lightweight mutex
+//
+// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
+//
+// 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
+//
+
+#include <ndnboost/smart_ptr/detail/lightweight_mutex.hpp>
+
+#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
diff --git a/ndnboost/detail/lightweight_test.hpp b/ndnboost/detail/lightweight_test.hpp
new file mode 100644
index 0000000..2b87b2e
--- /dev/null
+++ b/ndnboost/detail/lightweight_test.hpp
@@ -0,0 +1,208 @@
+#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
+#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// boost/detail/lightweight_test.hpp - lightweight test library
+//
+// Copyright (c) 2002, 2009 Peter Dimov
+// Copyright (2) Beman Dawes 2010, 2011
+// Copyright (3) Ion Gaztanaga 2013
+//
+// 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
+//
+// ---------------
+//
+// If expression is false increases the error count
+// and outputs a message containing 'expression'
+//
+// BOOST_TEST(expression)
+//
+// ---------------
+//
+// Increases error count and outputs a message containing 'message'
+//
+// BOOST_ERROR(message)
+//
+// ---------------
+//
+// If 'expr1' != 'expr2' increases the error count
+// and outputs a message containing both expressions
+//
+// BOOST_TEST_EQ(expr1, expr2)
+//
+// ---------------
+//
+// If 'expr1' == 'expr2' increases the error count
+// and outputs a message containing both expressions
+//
+// BOOST_TEST_NE(expr1, expr2)
+//
+// ---------------
+//
+// If BOOST_NO_EXCEPTIONS is NOT defined and if 'expr' does not
+// throw an exception of type 'excep', increases the error count
+// and outputs a message containing the expression.
+//
+// If BOOST_NO_EXCEPTIONS is defined, this macro expands to nothing
+// and 'expr' is not evaluated.
+//
+// BOOST_TEST_THROWS(expr, excep)
+//
+// ---------------
+//
+// Returns the error count
+//
+// int ndnboost::report_errors()
+//
+
+#include <iostream>
+#include <ndnboost/current_function.hpp>
+#include <ndnboost/assert.hpp>
+#include <ndnboost/detail/no_exceptions_support.hpp>
+
+// IDE's like Visual Studio perform better if output goes to std::cout or
+// some other stream, so allow user to configure output stream:
+#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
+# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
+#endif
+
+namespace ndnboost
+{
+
+namespace detail
+{
+
+struct report_errors_reminder
+{
+ bool called_report_errors_function;
+ report_errors_reminder() : called_report_errors_function(false) {}
+ ~report_errors_reminder()
+ {
+ BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
+ }
+};
+
+inline report_errors_reminder& report_errors_remind()
+{
+ static report_errors_reminder r;
+ return r;
+}
+
+inline int & test_errors()
+{
+ static int x = 0;
+ report_errors_remind();
+ return x;
+}
+
+inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
+{
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << file << "(" << line << "): test '" << expr << "' failed in function '"
+ << function << "'" << std::endl;
+ ++test_errors();
+}
+
+inline void error_impl(char const * msg, char const * file, int line, char const * function)
+{
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << file << "(" << line << "): " << msg << " in function '"
+ << function << "'" << std::endl;
+ ++test_errors();
+}
+
+inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
+{
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
+ << function << "'" << std::endl;
+ ++test_errors();
+}
+
+template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
+ char const * file, int line, char const * function, T const & t, U const & u )
+{
+ if( t == u )
+ {
+ }
+ else
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << file << "(" << line << "): test '" << expr1 << " == " << expr2
+ << "' failed in function '" << function << "': "
+ << "'" << t << "' != '" << u << "'" << std::endl;
+ ++test_errors();
+ }
+}
+
+template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
+ char const * file, int line, char const * function, T const & t, U const & u )
+{
+ if( t != u )
+ {
+ }
+ else
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << file << "(" << line << "): test '" << expr1 << " != " << expr2
+ << "' failed in function '" << function << "': "
+ << "'" << t << "' == '" << u << "'" << std::endl;
+ ++test_errors();
+ }
+}
+
+} // namespace detail
+
+inline int report_errors()
+{
+ detail::report_errors_remind().called_report_errors_function = true;
+
+ int errors = detail::test_errors();
+
+ if( errors == 0 )
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << "No errors detected." << std::endl;
+ return 0;
+ }
+ else
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM
+ << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
+ return 1;
+ }
+}
+
+} // namespace ndnboost
+
+#define BOOST_TEST(expr) ((expr)? (void)0: ::ndnboost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
+#define BOOST_ERROR(msg) ::ndnboost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
+#define BOOST_TEST_EQ(expr1,expr2) ( ::ndnboost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
+#define BOOST_TEST_NE(expr1,expr2) ( ::ndnboost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
+#ifndef BOOST_NO_EXCEPTIONS
+ #define BOOST_TEST_THROWS( EXPR, EXCEP ) \
+ try { \
+ EXPR; \
+ ::ndnboost::detail::throw_failed_impl \
+ (#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
+ } \
+ catch(EXCEP const&) { \
+ } \
+ catch(...) { \
+ ::ndnboost::detail::throw_failed_impl \
+ (#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
+ } \
+ //
+#else
+ #define BOOST_TEST_THROWS( EXPR, EXCEP )
+#endif
+
+#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
diff --git a/ndnboost/detail/no_exceptions_support.hpp b/ndnboost/detail/no_exceptions_support.hpp
new file mode 100644
index 0000000..a56958e
--- /dev/null
+++ b/ndnboost/detail/no_exceptions_support.hpp
@@ -0,0 +1,87 @@
+#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
+#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+//----------------------------------------------------------------------
+// (C) Copyright 2004 Pavel Vozenilek.
+// Use, modification and distribution is subject to 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)
+//
+//
+// This file contains helper macros used when exception support may be
+// disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
+//
+// Before picking up these macros you may consider using RAII techniques
+// to deal with exceptions - their syntax can be always the same with
+// or without exception support enabled.
+//
+
+/* Example of use:
+
+void foo() {
+ BOOST_TRY {
+ ...
+ } BOOST_CATCH(const std::bad_alloc&) {
+ ...
+ BOOST_RETHROW
+ } BOOST_CATCH(const std::exception& e) {
+ ...
+ }
+ BOOST_CATCH_END
+}
+
+With exception support enabled it will expand into:
+
+void foo() {
+ { try {
+ ...
+ } catch (const std::bad_alloc&) {
+ ...
+ throw;
+ } catch (const std::exception& e) {
+ ...
+ }
+ }
+}
+
+With exception support disabled it will expand into:
+
+void foo() {
+ { if(true) {
+ ...
+ } else if (false) {
+ ...
+ } else if (false) {
+ ...
+ }
+ }
+}
+*/
+//----------------------------------------------------------------------
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+#if !(defined BOOST_NO_EXCEPTIONS)
+# define BOOST_TRY { try
+# define BOOST_CATCH(x) catch(x)
+# define BOOST_RETHROW throw;
+# define BOOST_CATCH_END }
+#else
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+# define BOOST_TRY { if ("")
+# define BOOST_CATCH(x) else if (!"")
+# else
+# define BOOST_TRY { if (true)
+# define BOOST_CATCH(x) else if (false)
+# endif
+# define BOOST_RETHROW
+# define BOOST_CATCH_END }
+#endif
+
+
+#endif
diff --git a/ndnboost/detail/ob_call_traits.hpp b/ndnboost/detail/ob_call_traits.hpp
new file mode 100644
index 0000000..45f3743
--- /dev/null
+++ b/ndnboost/detail/ob_call_traits.hpp
@@ -0,0 +1,168 @@
+// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
+// Use, modification and distribution are subject to 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/utility for most recent version including documentation.
+//
+// Crippled version for crippled compilers:
+// see libs/utility/call_traits.htm
+//
+
+/* Release notes:
+ 01st October 2000:
+ Fixed call_traits on VC6, using "poor man's partial specialisation",
+ using ideas taken from "Generative programming" by Krzysztof Czarnecki
+ & Ulrich Eisenecker.
+*/
+
+#ifndef BOOST_OB_CALL_TRAITS_HPP
+#define BOOST_OB_CALL_TRAITS_HPP
+
+#ifndef BOOST_CONFIG_HPP
+#include <ndnboost/config.hpp>
+#endif
+
+#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP
+#include <ndnboost/type_traits/arithmetic_traits.hpp>
+#endif
+#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP
+#include <ndnboost/type_traits/composite_traits.hpp>
+#endif
+
+namespace ndnboost{
+
+#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
+//
+// use member templates to emulate
+// partial specialisation:
+//
+namespace detail{
+
+template <class T>
+struct standard_call_traits
+{
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef const T& param_type;
+};
+template <class T>
+struct simple_call_traits
+{
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef const T param_type;
+};
+template <class T>
+struct reference_call_traits
+{
+ typedef T value_type;
+ typedef T reference;
+ typedef T const_reference;
+ typedef T param_type;
+};
+
+template <bool pointer, bool arithmetic, bool reference>
+struct call_traits_chooser
+{
+ template <class T>
+ struct rebind
+ {
+ typedef standard_call_traits<T> type;
+ };
+};
+
+template <>
+struct call_traits_chooser<true, false, false>
+{
+ template <class T>
+ struct rebind
+ {
+ typedef simple_call_traits<T> type;
+ };
+};
+
+template <>
+struct call_traits_chooser<false, false, true>
+{
+ template <class T>
+ struct rebind
+ {
+ typedef reference_call_traits<T> type;
+ };
+};
+
+template <bool size_is_small>
+struct call_traits_sizeof_chooser2
+{
+ template <class T>
+ struct small_rebind
+ {
+ typedef simple_call_traits<T> small_type;
+ };
+};
+
+template<>
+struct call_traits_sizeof_chooser2<false>
+{
+ template <class T>
+ struct small_rebind
+ {
+ typedef standard_call_traits<T> small_type;
+ };
+};
+
+template <>
+struct call_traits_chooser<false, true, false>
+{
+ template <class T>
+ struct rebind
+ {
+ enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) };
+ typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser;
+ typedef typename chooser::template small_rebind<T> bound_type;
+ typedef typename bound_type::small_type type;
+ };
+};
+
+} // namespace detail
+template <typename T>
+struct call_traits
+{
+private:
+ typedef detail::call_traits_chooser<
+ ::ndnboost::is_pointer<T>::value,
+ ::ndnboost::is_arithmetic<T>::value,
+ ::ndnboost::is_reference<T>::value
+ > chooser;
+ typedef typename chooser::template rebind<T> bound_type;
+ typedef typename bound_type::type call_traits_type;
+public:
+ typedef typename call_traits_type::value_type value_type;
+ typedef typename call_traits_type::reference reference;
+ typedef typename call_traits_type::const_reference const_reference;
+ typedef typename call_traits_type::param_type param_type;
+};
+
+#else
+//
+// sorry call_traits is completely non-functional
+// blame your broken compiler:
+//
+
+template <typename T>
+struct call_traits
+{
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef const T& param_type;
+};
+
+#endif // member templates
+
+}
+
+#endif // BOOST_OB_CALL_TRAITS_HPP
diff --git a/ndnboost/detail/select_type.hpp b/ndnboost/detail/select_type.hpp
new file mode 100644
index 0000000..8e3cac7
--- /dev/null
+++ b/ndnboost/detail/select_type.hpp
@@ -0,0 +1,36 @@
+// (C) Copyright David Abrahams 2001.
+// 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 for most recent version including documentation.
+
+// Revision History
+// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
+// specialization to unspecialized template (David Abrahams)
+// 06 Feb 01 Created (David Abrahams)
+
+#ifndef SELECT_TYPE_DWA20010206_HPP
+# define SELECT_TYPE_DWA20010206_HPP
+
+namespace ndnboost { namespace detail {
+
+ // Template class if_true -- select among 2 types based on a bool constant expression
+ // Usage:
+ // typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
+
+ // HP aCC cannot deal with missing names for template value parameters
+ template <bool b> struct if_true
+ {
+ template <class T, class F>
+ struct then { typedef T type; };
+ };
+
+ template <>
+ struct if_true<false>
+ {
+ template <class T, class F>
+ struct then { typedef F type; };
+ };
+}}
+#endif // SELECT_TYPE_DWA20010206_HPP
diff --git a/ndnboost/detail/templated_streams.hpp b/ndnboost/detail/templated_streams.hpp
new file mode 100644
index 0000000..b1159f8
--- /dev/null
+++ b/ndnboost/detail/templated_streams.hpp
@@ -0,0 +1,74 @@
+//-----------------------------------------------------------------------------
+// boost detail/templated_streams.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2003
+// Eric Friedman
+//
+// 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)
+
+#ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP
+#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP
+
+#include "ndnboost/config.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// (detail) BOOST_TEMPLATED_STREAM_* macros
+//
+// Provides workaround platforms without stream class templates.
+//
+
+#if !defined(BOOST_NO_STD_LOCALE)
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \
+ template < typename E , typename T >
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \
+ template < typename E , typename T , typename A >
+
+#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \
+ typename E , typename T
+
+#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \
+ typename E , typename T , typename A
+
+#define BOOST_TEMPLATED_STREAM_COMMA ,
+
+#define BOOST_TEMPLATED_STREAM_ELEM(E) E
+#define BOOST_TEMPLATED_STREAM_TRAITS(T) T
+#define BOOST_TEMPLATED_STREAM_ALLOC(A) A
+
+#define BOOST_TEMPLATED_STREAM(X,E,T) \
+ BOOST_JOIN(std::basic_,X)< E , T >
+
+#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
+ BOOST_JOIN(std::basic_,X)< E , T , A >
+
+#else // defined(BOOST_NO_STD_LOCALE)
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/
+
+#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/
+
+#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/
+
+#define BOOST_TEMPLATED_STREAM_COMMA /**/
+
+#define BOOST_TEMPLATED_STREAM_ELEM(E) char
+#define BOOST_TEMPLATED_STREAM_TRAITS(T) std::char_traits<char>
+#define BOOST_TEMPLATED_STREAM_ALLOC(A) std::allocator<char>
+
+#define BOOST_TEMPLATED_STREAM(X,E,T) \
+ std::X
+
+#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
+ std::X
+
+#endif // BOOST_NO_STD_LOCALE
+
+#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP