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/iterator/detail/config_def.hpp b/ndnboost/iterator/detail/config_def.hpp
new file mode 100644
index 0000000..861072b
--- /dev/null
+++ b/ndnboost/iterator/detail/config_def.hpp
@@ -0,0 +1,137 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 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)
+
+// no include guard multiple inclusion intended
+
+//
+// This is a temporary workaround until the bulk of this is
+// available in boost config.
+// 23/02/03 thw
+//
+
+#include <ndnboost/config.hpp> // for prior
+#include <ndnboost/detail/workaround.hpp>
+
+#ifdef BOOST_ITERATOR_CONFIG_DEF
+# error you have nested config_def #inclusion.
+#else
+# define BOOST_ITERATOR_CONFIG_DEF
+#endif
+
+// We enable this always now. Otherwise, the simple case in
+// libs/iterator/test/constant_iterator_arrow.cpp fails to compile
+// because the operator-> return is improperly deduced as a non-const
+// pointer.
+#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531))
+
+// Recall that in general, compilers without partial specialization
+// can't strip constness. Consider counting_iterator, which normally
+// passes a const Value to iterator_facade. As a result, any code
+// which makes a std::vector of the iterator's value_type will fail
+// when its allocator declares functions overloaded on reference and
+// const_reference (the same type).
+//
+// Furthermore, Borland 5.5.1 drops constness in enough ways that we
+// end up using a proxy for operator[] when we otherwise shouldn't.
+// Using reference constness gives it an extra hint that it can
+// return the value_type from operator[] directly, but is not
+// strictly necessary. Not sure how best to resolve this one.
+
+# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1
+
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \
+ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
+ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \
+ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+
+# define BOOST_NO_LVALUE_RETURN_DETECTION
+
+# if 0 // test code
+ struct v {};
+
+ typedef char (&no)[3];
+
+ template <class T>
+ no foo(T const&, ...);
+
+ template <class T>
+ char foo(T&, int);
+
+
+ struct value_iterator
+ {
+ v operator*() const;
+ };
+
+ template <class T>
+ struct lvalue_deref_helper
+ {
+ static T& x;
+ enum { value = (sizeof(foo(*x,0)) == 1) };
+ };
+
+ int z2[(lvalue_deref_helper<v*>::value == 1) ? 1 : -1];
+ int z[(lvalue_deref_helper<value_iterator>::value) == 1 ? -1 : 1 ];
+# endif
+
+#endif
+
+#if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
+# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types"
+#endif
+
+#if BOOST_WORKAROUND(__GNUC__, == 2) \
+ || BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile:
+
+# if 0 // test code
+ #include <ndnboost/type_traits/is_convertible.hpp>
+ template <class T>
+ struct foo
+ {
+ foo(T);
+
+ template <class U>
+ foo(foo<U> const& other) : p(other.p) { }
+
+ T p;
+ };
+
+ bool x = ndnboost::is_convertible<foo<int const*>, foo<int*> >::value;
+# endif
+
+#endif
+
+
+#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE))
+# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+#endif
+
+# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+# define BOOST_ARG_DEPENDENT_TYPENAME typename
+# else
+# define BOOST_ARG_DEPENDENT_TYPENAME
+# endif
+
+# if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+
+// GCC-2.95 eagerly instantiates templated constructors and conversion
+// operators in convertibility checks, causing premature errors.
+//
+// Borland's problems are harder to diagnose due to lack of an
+// instantiation stack backtrace. They may be due in part to the fact
+// that it drops cv-qualification willy-nilly in templates.
+# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+# endif
+
+// no include guard; multiple inclusion intended
diff --git a/ndnboost/iterator/detail/config_undef.hpp b/ndnboost/iterator/detail/config_undef.hpp
new file mode 100644
index 0000000..9dcd1d5
--- /dev/null
+++ b/ndnboost/iterator/detail/config_undef.hpp
@@ -0,0 +1,25 @@
+// (C) Copyright Thomas Witt 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)
+
+// no include guard multiple inclusion intended
+
+//
+// This is a temporary workaround until the bulk of this is
+// available in boost config.
+// 23/02/03 thw
+//
+
+#undef BOOST_NO_IS_CONVERTIBLE
+#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE
+#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+#undef BOOST_ARG_DEPENDENT_TYPENAME
+#undef BOOST_NO_LVALUE_RETURN_DETECTION
+#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+
+#ifdef BOOST_ITERATOR_CONFIG_DEF
+# undef BOOST_ITERATOR_CONFIG_DEF
+#else
+# error missing or nested #include config_def
+#endif
diff --git a/ndnboost/iterator/iterator_categories.hpp b/ndnboost/iterator/iterator_categories.hpp
new file mode 100644
index 0000000..9adc13d
--- /dev/null
+++ b/ndnboost/iterator/iterator_categories.hpp
@@ -0,0 +1,188 @@
+// (C) Copyright Jeremy Siek 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)
+
+#ifndef BOOST_ITERATOR_CATEGORIES_HPP
+# define BOOST_ITERATOR_CATEGORIES_HPP
+
+# include <ndnboost/config.hpp>
+# include <ndnboost/detail/iterator.hpp>
+# include <ndnboost/iterator/detail/config_def.hpp>
+
+# include <ndnboost/detail/workaround.hpp>
+
+# include <ndnboost/mpl/eval_if.hpp>
+# include <ndnboost/mpl/identity.hpp>
+# include <ndnboost/mpl/placeholders.hpp>
+# include <ndnboost/mpl/aux_/lambda_support.hpp>
+
+# include <ndnboost/type_traits/is_convertible.hpp>
+
+# include <ndnboost/static_assert.hpp>
+
+namespace ndnboost {
+
+//
+// Traversal Categories
+//
+
+struct no_traversal_tag {};
+
+struct incrementable_traversal_tag
+ : no_traversal_tag
+{
+// incrementable_traversal_tag() {}
+// incrementable_traversal_tag(std::output_iterator_tag const&) {};
+};
+
+struct single_pass_traversal_tag
+ : incrementable_traversal_tag
+{
+// single_pass_traversal_tag() {}
+// single_pass_traversal_tag(std::input_iterator_tag const&) {};
+};
+
+struct forward_traversal_tag
+ : single_pass_traversal_tag
+{
+// forward_traversal_tag() {}
+// forward_traversal_tag(std::forward_iterator_tag const&) {};
+};
+
+struct bidirectional_traversal_tag
+ : forward_traversal_tag
+{
+// bidirectional_traversal_tag() {};
+// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {};
+};
+
+struct random_access_traversal_tag
+ : bidirectional_traversal_tag
+{
+// random_access_traversal_tag() {};
+// random_access_traversal_tag(std::random_access_iterator_tag const&) {};
+};
+
+namespace detail
+{
+ //
+ // Convert a "strictly old-style" iterator category to a traversal
+ // tag. This is broken out into a separate metafunction to reduce
+ // the cost of instantiating iterator_category_to_traversal, below,
+ // for new-style types.
+ //
+ template <class Cat>
+ struct old_category_to_traversal
+ : mpl::eval_if<
+ is_convertible<Cat,std::random_access_iterator_tag>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::bidirectional_iterator_tag>
+ , mpl::identity<bidirectional_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::forward_iterator_tag>
+ , mpl::identity<forward_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::input_iterator_tag>
+ , mpl::identity<single_pass_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::output_iterator_tag>
+ , mpl::identity<incrementable_traversal_tag>
+ , void
+ >
+ >
+ >
+ >
+ >
+ {};
+
+# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ template <>
+ struct old_category_to_traversal<int>
+ {
+ typedef int type;
+ };
+# endif
+
+ template <class Traversal>
+ struct pure_traversal_tag
+ : mpl::eval_if<
+ is_convertible<Traversal,random_access_traversal_tag>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,bidirectional_traversal_tag>
+ , mpl::identity<bidirectional_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,forward_traversal_tag>
+ , mpl::identity<forward_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,single_pass_traversal_tag>
+ , mpl::identity<single_pass_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,incrementable_traversal_tag>
+ , mpl::identity<incrementable_traversal_tag>
+ , void
+ >
+ >
+ >
+ >
+ >
+ {
+ };
+
+# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ template <>
+ struct pure_traversal_tag<int>
+ {
+ typedef int type;
+ };
+# endif
+
+} // namespace detail
+
+
+//
+// Convert an iterator category into a traversal tag
+//
+template <class Cat>
+struct iterator_category_to_traversal
+ : mpl::eval_if< // if already convertible to a traversal tag, we're done.
+ is_convertible<Cat,incrementable_traversal_tag>
+ , mpl::identity<Cat>
+ , ndnboost::detail::old_category_to_traversal<Cat>
+ >
+{};
+
+// Trait to get an iterator's traversal category
+template <class Iterator = mpl::_1>
+struct iterator_traversal
+ : iterator_category_to_traversal<
+ typename ndnboost::detail::iterator_traits<Iterator>::iterator_category
+ >
+{};
+
+# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
+// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work
+// out well. Instantiating the nested apply template also
+// requires instantiating iterator_traits on the
+// placeholder. Instead we just specialize it as a metafunction
+// class.
+template <>
+struct iterator_traversal<mpl::_1>
+{
+ template <class T>
+ struct apply : iterator_traversal<T>
+ {};
+};
+template <>
+struct iterator_traversal<mpl::_>
+ : iterator_traversal<mpl::_1>
+{};
+# endif
+
+} // namespace ndnboost
+
+#include <ndnboost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_ITERATOR_CATEGORIES_HPP
diff --git a/ndnboost/iterator/iterator_traits.hpp b/ndnboost/iterator/iterator_traits.hpp
new file mode 100644
index 0000000..78565d3
--- /dev/null
+++ b/ndnboost/iterator/iterator_traits.hpp
@@ -0,0 +1,92 @@
+// Copyright David Abrahams 2003.
+// 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 ITERATOR_TRAITS_DWA200347_HPP
+# define ITERATOR_TRAITS_DWA200347_HPP
+
+# include <ndnboost/detail/iterator.hpp>
+# include <ndnboost/detail/workaround.hpp>
+
+namespace ndnboost {
+
+// Unfortunately, g++ 2.95.x chokes when we define a class template
+// iterator_category which has the same name as its
+// std::iterator_category() function, probably due in part to the
+// "std:: is visible globally" hack it uses. Use
+// BOOST_ITERATOR_CATEGORY to write code that's portable to older
+// GCCs.
+
+# if BOOST_WORKAROUND(__GNUC__, <= 2)
+# define BOOST_ITERATOR_CATEGORY iterator_category_
+# else
+# define BOOST_ITERATOR_CATEGORY iterator_category
+# endif
+
+
+template <class Iterator>
+struct iterator_value
+{
+ typedef typename ndnboost::detail::iterator_traits<Iterator>::value_type type;
+};
+
+template <class Iterator>
+struct iterator_reference
+{
+ typedef typename ndnboost::detail::iterator_traits<Iterator>::reference type;
+};
+
+
+template <class Iterator>
+struct iterator_pointer
+{
+ typedef typename ndnboost::detail::iterator_traits<Iterator>::pointer type;
+};
+
+template <class Iterator>
+struct iterator_difference
+{
+ typedef typename ndnboost::detail::iterator_traits<Iterator>::difference_type type;
+};
+
+template <class Iterator>
+struct BOOST_ITERATOR_CATEGORY
+{
+ typedef typename ndnboost::detail::iterator_traits<Iterator>::iterator_category type;
+};
+
+# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+template <>
+struct iterator_value<int>
+{
+ typedef void type;
+};
+
+template <>
+struct iterator_reference<int>
+{
+ typedef void type;
+};
+
+template <>
+struct iterator_pointer<int>
+{
+ typedef void type;
+};
+
+template <>
+struct iterator_difference<int>
+{
+ typedef void type;
+};
+
+template <>
+struct BOOST_ITERATOR_CATEGORY<int>
+{
+ typedef void type;
+};
+# endif
+
+} // namespace ndnboost::iterator
+
+#endif // ITERATOR_TRAITS_DWA200347_HPP