diff --git a/ndnboost/functional/factory.hpp b/ndnboost/functional/factory.hpp
new file mode 100644
index 0000000..161465d
--- /dev/null
+++ b/ndnboost/functional/factory.hpp
@@ -0,0 +1,163 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    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).
+==============================================================================*/
+
+#ifndef BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED
+#   ifndef BOOST_PP_IS_ITERATING
+
+#     include <ndnboost/preprocessor/iteration/iterate.hpp>
+#     include <ndnboost/preprocessor/repetition/enum_params.hpp>
+#     include <ndnboost/preprocessor/repetition/enum_binary_params.hpp>
+
+#     include <new>
+#     include <ndnboost/pointee.hpp>
+#     include <ndnboost/none_t.hpp>
+#     include <ndnboost/get_pointer.hpp>
+#     include <ndnboost/non_type.hpp>
+#     include <ndnboost/type_traits/remove_cv.hpp>
+
+#     ifndef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY
+#       define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 10
+#     elif BOOST_FUNCTIONAL_FACTORY_MAX_ARITY < 3
+#       undef  BOOST_FUNCTIONAL_FACTORY_MAX_ARITY
+#       define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 3
+#     endif
+
+namespace ndnboost
+{
+    enum factory_alloc_propagation
+    {
+        factory_alloc_for_pointee_and_deleter,
+        factory_passes_alloc_to_smart_pointer
+    };
+
+    template< typename Pointer, class Allocator = ndnboost::none_t,
+        factory_alloc_propagation AP = factory_alloc_for_pointee_and_deleter >
+    class factory;
+
+    //----- ---- --- -- - -  -   -
+
+    template< typename Pointer, factory_alloc_propagation AP >
+    class factory<Pointer, ndnboost::none_t, AP> 
+    {
+      public:
+        typedef typename ndnboost::remove_cv<Pointer>::type result_type;
+        typedef typename ndnboost::pointee<result_type>::type value_type;
+
+        factory()
+        { }
+
+#     define BOOST_PP_FILENAME_1 <ndnboost/functional/factory.hpp>
+#     define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY)
+#     include BOOST_PP_ITERATE()
+    };
+
+    template< class Pointer, class Allocator, factory_alloc_propagation AP >
+    class factory
+        : private Allocator::template rebind< typename ndnboost::pointee<
+            typename ndnboost::remove_cv<Pointer>::type >::type >::other
+    {
+      public:
+        typedef typename ndnboost::remove_cv<Pointer>::type result_type;
+        typedef typename ndnboost::pointee<result_type>::type value_type;
+
+        typedef typename Allocator::template rebind<value_type>::other
+            allocator_type;
+
+        explicit factory(allocator_type const & a = allocator_type())
+          : allocator_type(a)
+        { }
+
+      private:
+
+        struct deleter
+            : allocator_type
+        {
+            inline deleter(allocator_type const& that) 
+              : allocator_type(that)
+            { }
+
+            allocator_type& get_allocator() const
+            {
+                return *const_cast<allocator_type*>(
+                    static_cast<allocator_type const*>(this));
+            }
+
+            void operator()(value_type* ptr) const
+            {
+                if (!! ptr) ptr->~value_type();
+                const_cast<allocator_type*>(static_cast<allocator_type const*>(
+                    this))->deallocate(ptr,1);
+            }
+        };
+
+        inline allocator_type& get_allocator() const
+        {
+            return *const_cast<allocator_type*>(
+                static_cast<allocator_type const*>(this));
+        }
+
+        inline result_type make_pointer(value_type* ptr, ndnboost::non_type<
+            factory_alloc_propagation,factory_passes_alloc_to_smart_pointer>)
+        const
+        {
+            return result_type(ptr,deleter(this->get_allocator()));
+        }
+        inline result_type make_pointer(value_type* ptr, ndnboost::non_type<
+            factory_alloc_propagation,factory_alloc_for_pointee_and_deleter>)
+        const
+        {
+            return result_type(ptr,deleter(this->get_allocator()),
+                this->get_allocator());
+        }
+
+      public:
+
+#     define BOOST_TMP_MACRO
+#     define BOOST_PP_FILENAME_1 <ndnboost/functional/factory.hpp>
+#     define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY)
+#     include BOOST_PP_ITERATE()
+#     undef BOOST_TMP_MACRO
+    };
+
+    template< typename Pointer, class Allocator, factory_alloc_propagation AP > 
+    class factory<Pointer&, Allocator, AP>;
+    // forbidden, would create a dangling reference
+}
+
+#     define BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED
+#   else // defined(BOOST_PP_IS_ITERATING)
+#     define N BOOST_PP_ITERATION()
+#     if !defined(BOOST_TMP_MACRO)
+#       if N > 0
+    template< BOOST_PP_ENUM_PARAMS(N, typename T) >
+#       endif
+    inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
+    {
+        return result_type( new value_type(BOOST_PP_ENUM_PARAMS(N,a)) );
+    }
+#     else // defined(BOOST_TMP_MACRO)
+#       if N > 0
+    template< BOOST_PP_ENUM_PARAMS(N, typename T) >
+#       endif
+    inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
+    {
+        value_type* memory = this->get_allocator().allocate(1);
+        try
+        { 
+            return make_pointer(
+                new(memory) value_type(BOOST_PP_ENUM_PARAMS(N,a)),
+                ndnboost::non_type<factory_alloc_propagation,AP>() );
+        }
+        catch (...) { this->get_allocator().deallocate(memory,1); throw; }
+    }
+#     endif
+#     undef N
+#   endif // defined(BOOST_PP_IS_ITERATING)
+
+#endif // include guard
+
diff --git a/ndnboost/functional/forward_adapter.hpp b/ndnboost/functional/forward_adapter.hpp
new file mode 100644
index 0000000..2bb5623
--- /dev/null
+++ b/ndnboost/functional/forward_adapter.hpp
@@ -0,0 +1,472 @@
+/*=============================================================================
+    Copyright (c) 2007-2008 Tobias Schwinger
+  
+    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).  
+==============================================================================*/
+
+#ifndef BOOST_FUNCTIONAL_FORWARD_ADAPTER_HPP_INCLUDED
+#   ifndef BOOST_PP_IS_ITERATING
+
+#   include <ndnboost/config.hpp>
+#   include <ndnboost/detail/workaround.hpp>
+
+#   include <ndnboost/preprocessor/iteration/iterate.hpp>
+#   include <ndnboost/preprocessor/repetition/enum_params.hpp>
+#   include <ndnboost/preprocessor/repetition/enum_binary_params.hpp>
+#   include <ndnboost/preprocessor/facilities/intercept.hpp>
+#   include <ndnboost/preprocessor/arithmetic/dec.hpp>
+
+#   include <ndnboost/utility/result_of.hpp>
+
+#   ifndef BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY
+#     define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 6
+#   elif BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY < 3
+#     undef  BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY
+#     define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 3
+#   endif
+
+
+namespace ndnboost 
+{
+    template< typename Function, int Arity_Or_MinArity = -1, int MaxArity = -1 >
+    class forward_adapter;
+
+    //----- ---- --- -- - -  -   -
+
+    namespace detail
+    {
+        template< class MostDerived, typename Function, typename FunctionConst, 
+            int Arity, int MinArity >
+        struct forward_adapter_impl;
+
+        struct forward_adapter_result
+        {
+            template< typename Sig > struct apply;
+
+            // Utility metafunction for qualification adjustment on arguments
+            template< typename T > struct q          { typedef T const t; };
+            template< typename T > struct q<T const> { typedef T const t; };
+            template< typename T > struct q<T &>     { typedef T       t; };
+
+            // Utility metafunction to choose target function qualification
+            template< typename T > struct c
+            { typedef typename T::target_function_t t; };
+            template< typename T > struct c<T&      >
+            { typedef typename T::target_function_t t; };
+            template< typename T > struct c<T const >
+            { typedef typename T::target_function_const_t t; };
+            template< typename T > struct c<T const&>
+            { typedef typename T::target_function_const_t t; };
+        };
+    }
+
+#   define BOOST_TMP_MACRO(f,fn,fc) \
+        ndnboost::detail::forward_adapter_impl< \
+            forward_adapter<f,Arity_Or_MinArity,MaxArity>, fn, fc, \
+            (MaxArity!=-1? MaxArity :Arity_Or_MinArity!=-1? Arity_Or_MinArity \
+                :BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY), \
+            (Arity_Or_MinArity!=-1? Arity_Or_MinArity : 0) >
+
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class forward_adapter
+        : public BOOST_TMP_MACRO(Function,Function,Function const)
+        , private Function
+    {
+      public:
+        forward_adapter(Function const& f = Function()) 
+          : Function(f) 
+        { }
+
+        typedef Function        target_function_t;
+        typedef Function const  target_function_const_t;
+
+        Function       & target_function()       { return *this; }
+        Function const & target_function() const { return *this; }
+
+        template< typename Sig > struct result
+            : detail::forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function,Function, Function const)::operator();
+    };
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class forward_adapter< Function const, Arity_Or_MinArity, MaxArity >
+        : public BOOST_TMP_MACRO(Function const, Function const, Function const)
+        , private Function
+    {
+      public:
+        forward_adapter(Function const& f = Function())
+          : Function(f) 
+        { }
+
+        typedef Function const target_function_t;
+        typedef Function const target_function_const_t;
+
+        Function const & target_function() const { return *this; }
+
+        template< typename Sig > struct result
+            : detail::forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function const,Function const, Function const)
+            ::operator();
+    };
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class forward_adapter< Function &, Arity_Or_MinArity, MaxArity >
+        : public BOOST_TMP_MACRO(Function&, Function, Function)
+    {
+        Function& ref_function;
+      public:
+        forward_adapter(Function& f)
+          : ref_function(f) 
+        { }
+
+        typedef Function target_function_t;
+        typedef Function target_function_const_t;
+
+        Function & target_function() const { return this->ref_function; }
+
+        template< typename Sig > struct result
+            : detail::forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function&, Function, Function)::operator();
+    }; 
+
+    #undef BOOST_TMP_MACRO
+
+    namespace detail
+    {
+        template< class Self >
+        struct forward_adapter_result::apply< Self() >
+            : ndnboost::result_of< BOOST_DEDUCED_TYPENAME c<Self>::t() >
+        { };
+
+        template< class MD, class F, class FC >
+        struct forward_adapter_impl<MD,F,FC,0,0>
+        {
+            inline typename ndnboost::result_of< FC() >::type
+            operator()() const
+            {
+                return static_cast<MD const*>(this)->target_function()();
+            }
+
+            inline typename ndnboost::result_of< F() >::type
+            operator()()
+            {
+                return static_cast<MD*>(this)->target_function()();
+            }
+
+        // closing brace gets generated by preprocessing code, below
+
+#       define BOOST_TMP_MACRO(tpl_params,arg_types,params,args)              \
+            template< tpl_params >                                             \
+            inline typename ndnboost::result_of< FC(arg_types) >::type            \
+            operator()(params) const                                           \
+            {                                                                  \
+                return static_cast<MD const*>(this)->target_function()(args);  \
+            }                                                                  \
+            template< tpl_params >                                             \
+            inline typename ndnboost::result_of< F(arg_types)>::type              \
+            operator()(params)                                                 \
+            {                                                                  \
+                return static_cast<MD*>(this)->target_function()(args);        \
+            }
+
+#       // This is the total number of iterations we need
+#       define count ((1 << BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY+1)-2)
+
+#       // Chain file iteration to virtually one loop
+#       if BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY <= 7
+#         define limit1 count
+#         define limit2 0
+#         define limit3 0
+#       else
+#         if BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY <= 15
+#           define limit1 (count >> 8)
+#           define limit2 255
+#           define limit3 0
+#         else
+#           define limit1 (count >> 16)
+#           define limit2 255
+#           define limit3 255
+#         endif
+#       endif
+
+#       define N 0
+
+#       define  BOOST_PP_FILENAME_1 <ndnboost/functional/forward_adapter.hpp>
+#       define  BOOST_PP_ITERATION_LIMITS (0,limit1)
+#       include BOOST_PP_ITERATE()
+
+#       undef N
+#       undef limit3
+#       undef limit2
+#       undef limit1
+#       undef count
+#       undef BOOST_TMP_MACRO
+
+        };
+
+    } // namespace detail
+
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::forward_adapter<F,A0,A1> const ()>
+        : ndnboost::detail::forward_adapter_result::template apply<
+            ndnboost::forward_adapter<F,A0,A1> const () >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::forward_adapter<F,A0,A1>()>
+        : ndnboost::detail::forward_adapter_result::template apply<
+            ndnboost::forward_adapter<F,A0,A1>() >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::forward_adapter<F,A0,A1> const& ()>
+        : ndnboost::detail::forward_adapter_result::template apply<
+            ndnboost::forward_adapter<F,A0,A1> const () >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::forward_adapter<F,A0,A1>& ()>
+        : ndnboost::detail::forward_adapter_result::template apply<
+            ndnboost::forward_adapter<F,A0,A1>() >
+    { };
+}
+
+#       define BOOST_FUNCTIONAL_FORWARD_ADAPTER_HPP_INCLUDED
+
+#   elif BOOST_PP_ITERATION_DEPTH() == 1 && limit2
+#     define  BOOST_PP_FILENAME_2 <ndnboost/functional/forward_adapter.hpp>
+#     define  BOOST_PP_ITERATION_LIMITS (0,limit2)
+#     include BOOST_PP_ITERATE()
+#   elif BOOST_PP_ITERATION_DEPTH() == 2 && limit3
+#     define  BOOST_PP_FILENAME_3 <ndnboost/functional/forward_adapter.hpp>
+#     define  BOOST_PP_ITERATION_LIMITS (0,limit3)
+#     include BOOST_PP_ITERATE()
+
+#   else
+
+#     // I is the loop counter
+#     if limit2 && limit3
+#       define I (BOOST_PP_ITERATION_1 << 16 | BOOST_PP_ITERATION_2 << 8 | \
+            BOOST_PP_ITERATION_3)
+#     elif limit2
+#       define I (BOOST_PP_ITERATION_1 << 8 | BOOST_PP_ITERATION_2)
+#     else
+#       define I BOOST_PP_ITERATION_1
+#     endif
+
+#     if I < count
+
+#       // Done for this arity? Increment N
+#       if (I+2 >> N+1) 
+#         if N == 0
+#           undef N
+#           define N 1
+#         elif N == 1
+#           undef N
+#           define N 2
+#         elif N == 2
+#           undef N
+#           define N 3
+#         elif N == 3
+#           undef N
+#           define N 4
+#         elif N == 4
+#           undef N
+#           define N 5
+#         elif N == 5
+#           undef N
+#           define N 6
+#         elif N == 6
+#           undef N
+#           define N 7
+#         elif N == 7
+#           undef N
+#           define N 8
+#         elif N == 8
+#           undef N
+#           define N 9
+#         elif N == 9
+#           undef N
+#           define N 10
+#         elif N == 10
+#           undef N
+#           define N 11
+#         elif N == 11
+#           undef N
+#           define N 12
+#         elif N == 12
+#           undef N
+#           define N 13
+#         elif N == 13
+#           undef N
+#           define N 14
+#         elif N == 14
+#           undef N
+#           define N 15
+#         elif N == 15
+#           undef N
+#           define N 16
+#         endif
+
+        };
+
+        template< class Self, BOOST_PP_ENUM_PARAMS(N,typename T) >
+        struct forward_adapter_result::apply< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
+            : ndnboost::result_of< 
+                BOOST_DEDUCED_TYPENAME c<Self>::t(BOOST_PP_ENUM_BINARY_PARAMS(N, 
+                      typename q<T,>::t& BOOST_PP_INTERCEPT)) >
+        { };
+
+        template< class MD, class F, class FC >
+        struct forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),N>
+        {
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename ndnboost::result_of< F(
+                BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)) >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT));
+        };
+
+        template< class MD, class F, class FC, int MinArity >
+        struct forward_adapter_impl<MD,F,FC,N,MinArity>
+            : forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>
+        {
+            using forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>::operator();
+
+#       endif
+
+#       // Zero based count for each arity would be I-(1<<N)+2, but we don't
+#       // need it, unless we need a nicer order.
+
+#       // Macros for the parameter's type modifiers.
+#       if I & 0x000001
+#         define PT0 T0 &
+#       else
+#         define PT0 T0 const &
+#       endif
+#       if I & 0x000002
+#         define PT1 T1 &
+#       else
+#         define PT1 T1 const &
+#       endif
+#       if I & 0x000004
+#         define PT2 T2 &
+#       else
+#         define PT2 T2 const &
+#       endif
+#       if I & 0x000008
+#         define PT3 T3 &
+#       else
+#         define PT3 T3 const &
+#       endif
+#       if I & 0x000010
+#         define PT4 T4 &
+#       else
+#         define PT4 T4 const &
+#       endif
+#       if I & 0x000020
+#         define PT5 T5 &
+#       else
+#         define PT5 T5 const &
+#       endif
+#       if I & 0x000040
+#         define PT6 T6 &
+#       else
+#         define PT6 T6 const &
+#       endif
+#       if I & 0x000080
+#         define PT7 T7 &
+#       else
+#         define PT7 T7 const &
+#       endif
+#       if I & 0x000100
+#         define PT8 T8 &
+#       else
+#         define PT8 T8 const &
+#       endif
+#       if I & 0x000200
+#         define PT9 T9 &
+#       else
+#         define PT9 T9 const &
+#       endif
+#       if I & 0x000400
+#         define PT10 T10 &
+#       else
+#         define PT10 T10 const &
+#       endif
+#       if I & 0x000800
+#         define PT11 T11 &
+#       else
+#         define PT11 T11 const &
+#       endif
+#       if I & 0x001000
+#         define PT12 T12 &
+#       else
+#         define PT12 T12 const &
+#       endif
+#       if I & 0x002000
+#         define PT13 T13 &
+#       else
+#         define PT13 T13 const &
+#       endif
+#       if I & 0x004000
+#         define PT14 T14 &
+#       else
+#         define PT14 T14 const &
+#       endif
+#       if I & 0x008000
+#         define PT15 T15 &
+#       else
+#         define PT15 T15 const &
+#       endif
+
+#       if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400)) 
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename ndnboost::result_of<  FC(BOOST_PP_ENUM_PARAMS(N,PT)) 
+                >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
+            {
+                return static_cast<MD const* const>(this)
+                    ->target_function()(BOOST_PP_ENUM_PARAMS(N,a));
+            }
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename ndnboost::result_of<  F(BOOST_PP_ENUM_PARAMS(N,PT))
+                >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
+            {
+                return static_cast<MD* const>(this)
+                    ->target_function()(BOOST_PP_ENUM_PARAMS(N,a));
+            }
+#       else
+        BOOST_TMP_MACRO(BOOST_PP_ENUM_PARAMS(N,typename T),
+            BOOST_PP_ENUM_PARAMS(N,PT), BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a),
+            BOOST_PP_ENUM_PARAMS(N,a) )
+        // ...generates uglier code but is faster - it caches ENUM_*
+#       endif
+
+#       undef PT0
+#       undef PT1
+#       undef PT2
+#       undef PT3
+#       undef PT4
+#       undef PT5
+#       undef PT6
+#       undef PT7
+#       undef PT8
+#       undef PT9
+#       undef PT10
+#       undef PT11
+#       undef PT12
+#       undef PT13
+#       undef PT14
+#       undef PT15
+
+#     endif // I < count
+
+#     undef I
+#   endif // defined(BOOST_PP_IS_ITERATING)
+
+#endif // include guard
+
diff --git a/ndnboost/functional/hash.hpp b/ndnboost/functional/hash.hpp
new file mode 100644
index 0000000..bcc68bc
--- /dev/null
+++ b/ndnboost/functional/hash.hpp
@@ -0,0 +1,7 @@
+
+// Copyright 2005-2009 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)
+
+#include <ndnboost/functional/hash/hash.hpp>
+
diff --git a/ndnboost/functional/hash/detail/float_functions.hpp b/ndnboost/functional/hash/detail/float_functions.hpp
new file mode 100644
index 0000000..5a6dce4
--- /dev/null
+++ b/ndnboost/functional/hash/detail/float_functions.hpp
@@ -0,0 +1,336 @@
+
+// Copyright 2005-2009 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)
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/config/no_tr1/cmath.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have
+// sufficiently good floating point support to not require any
+// workarounds.
+//
+// When set to 0, the library tries to automatically
+// use the best available implementation. This normally works well, but
+// breaks when ambiguities are created by odd namespacing of the functions.
+//
+// Note that if this is set to 0, the library should still take full
+// advantage of the platform's floating point support.
+
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__LIBCOMO__)
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
+// Rogue Wave library:
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(_LIBCPP_VERSION)
+// libc++
+#   define BOOST_HASH_CONFORMANT_FLOATS 1
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+// GNU libstdc++ 3
+#   if defined(__GNUC__) && __GNUC__ >= 4
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#elif defined(__STL_CONFIG_H)
+// generic SGI STL
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__MSL_CPP__)
+// MSL standard lib:
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif defined(__IBMCPP__)
+// VACPP std lib (probably conformant for much earlier version).
+#   if __IBMCPP__ >= 1210
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#elif defined(MSIPL_COMPILE_H)
+// Modena C++ standard library
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+// Dinkumware Library (this has to appear after any possible replacement libraries):
+#   if _CPPLIB_VER >= 405
+#       define BOOST_HASH_CONFORMANT_FLOATS 1
+#   else
+#       define BOOST_HASH_CONFORMANT_FLOATS 0
+#   endif
+#else
+#   define BOOST_HASH_CONFORMANT_FLOATS 0
+#endif
+
+#if BOOST_HASH_CONFORMANT_FLOATS
+
+// The standard library is known to be compliant, so don't use the
+// configuration mechanism.
+
+namespace ndnboost {
+    namespace hash_detail {
+        template <typename Float>
+        struct call_ldexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int y) const {
+                return std::ldexp(x, y);
+            }
+        };
+
+        template <typename Float>
+        struct call_frexp {
+            typedef Float float_type;
+            inline Float operator()(Float x, int* y) const {
+                return std::frexp(x, y);
+            }
+        };
+
+        template <typename Float>
+        struct select_hash_type
+        {
+            typedef Float type;
+        };
+    }
+}
+
+#else // BOOST_HASH_CONFORMANT_FLOATS == 0
+
+// The C++ standard requires that the C float functions are overloarded
+// for float, double and long double in the std namespace, but some of the older
+// library implementations don't support this. On some that don't, the C99
+// float functions (frexpf, frexpl, etc.) are available.
+//
+// The following tries to automatically detect which are available.
+
+namespace ndnboost {
+    namespace hash_detail {
+
+        // Returned by dummy versions of the float functions.
+    
+        struct not_found {
+            // Implicitly convertible to float and long double in order to avoid
+            // a compile error when the dummy float functions are used.
+
+            inline operator float() const { return 0; }
+            inline operator long double() const { return 0; }
+        };
+          
+        // A type for detecting the return type of functions.
+
+        template <typename T> struct is;
+        template <> struct is<float> { char x[10]; };
+        template <> struct is<double> { char x[20]; };
+        template <> struct is<long double> { char x[30]; };
+        template <> struct is<ndnboost::hash_detail::not_found> { char x[40]; };
+            
+        // Used to convert the return type of a function to a type for sizeof.
+
+        template <typename T> is<T> float_type(T);
+
+        // call_ldexp
+        //
+        // This will get specialized for float and long double
+        
+        template <typename Float> struct call_ldexp
+        {
+            typedef double float_type;
+            
+            inline double operator()(double a, int b) const
+            {
+                using namespace std;
+                return ldexp(a, b);
+            }
+        };
+
+        // call_frexp
+        //
+        // This will get specialized for float and long double
+
+        template <typename Float> struct call_frexp
+        {
+            typedef double float_type;
+            
+            inline double operator()(double a, int* b) const
+            {
+                using namespace std;
+                return frexp(a, b);
+            }
+        };
+    }
+}
+            
+// A namespace for dummy functions to detect when the actual function we want
+// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.
+//
+// AFAICT these have to be outside of the boost namespace, as if they're in
+// the boost namespace they'll always be preferable to any other function
+// (since the arguments are built in types, ADL can't be used).
+
+namespace ndnboost_hash_detect_float_functions {
+    template <class Float> ndnboost::hash_detail::not_found ldexp(Float, int);
+    template <class Float> ndnboost::hash_detail::not_found frexp(Float, int*);    
+}
+
+// Macros for generating specializations of call_ldexp and call_frexp.
+//
+// check_cpp and check_c99 check if the C++ or C99 functions are available.
+//
+// Then the call_* functions select an appropriate implementation.
+//
+// I used c99_func in a few places just to get a unique name.
+//
+// Important: when using 'using namespace' at namespace level, include as
+// little as possible in that namespace, as Visual C++ has an odd bug which
+// can cause the namespace to be imported at the global level. This seems to
+// happen mainly when there's a template in the same namesapce.
+
+#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2)    \
+namespace ndnboost_hash_detect_float_functions {                           \
+    template <class Float>                                              \
+    ndnboost::hash_detail::not_found c99_func(Float, type2);               \
+}                                                                       \
+                                                                        \
+namespace ndnboost {                                                       \
+    namespace hash_detail {                                             \
+        namespace c99_func##_detect {                                   \
+            using namespace std;                                        \
+            using namespace ndnboost_hash_detect_float_functions;          \
+                                                                        \
+            struct check {                                              \
+                static type1 x;                                         \
+                static type2 y;                                         \
+                BOOST_STATIC_CONSTANT(bool, cpp =                       \
+                    sizeof(float_type(cpp_func(x,y)))                   \
+                        == sizeof(is<type1>));                          \
+                BOOST_STATIC_CONSTANT(bool, c99 =                       \
+                    sizeof(float_type(c99_func(x,y)))                   \
+                        == sizeof(is<type1>));                          \
+            };                                                          \
+        }                                                               \
+                                                                        \
+        template <bool x>                                               \
+        struct call_c99_##c99_func :                                    \
+            ndnboost::hash_detail::call_##cpp_func<double> {};             \
+                                                                        \
+        template <>                                                     \
+        struct call_c99_##c99_func<true> {                              \
+            typedef type1 float_type;                                   \
+                                                                        \
+            template <typename T>                                       \
+            inline type1 operator()(type1 a, T b)  const                \
+            {                                                           \
+                using namespace std;                                    \
+                return c99_func(a, b);                                  \
+            }                                                           \
+        };                                                              \
+                                                                        \
+        template <bool x>                                               \
+        struct call_cpp_##c99_func :                                    \
+            call_c99_##c99_func<                                        \
+                ::ndnboost::hash_detail::c99_func##_detect::check::c99     \
+            > {};                                                       \
+                                                                        \
+        template <>                                                     \
+        struct call_cpp_##c99_func<true> {                              \
+            typedef type1 float_type;                                   \
+                                                                        \
+            template <typename T>                                       \
+            inline type1 operator()(type1 a, T b)  const                \
+            {                                                           \
+                using namespace std;                                    \
+                return cpp_func(a, b);                                  \
+            }                                                           \
+        };                                                              \
+                                                                        \
+        template <>                                                     \
+        struct call_##cpp_func<type1> :                                 \
+            call_cpp_##c99_func<                                        \
+                ::ndnboost::hash_detail::c99_func##_detect::check::cpp     \
+            > {};                                                       \
+    }                                                                   \
+}
+
+#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2)   \
+namespace ndnboost {                                                       \
+    namespace hash_detail {                                             \
+                                                                        \
+        template <>                                                     \
+        struct call_##cpp_func<type1> {                                 \
+            typedef type1 float_type;                                   \
+            inline type1 operator()(type1 x, type2 y) const {           \
+                return c99_func(x, y);                                  \
+            }                                                           \
+        };                                                              \
+    }                                                                   \
+}
+
+#if defined(ldexpf)
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)
+#else
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)
+#endif
+
+#if defined(ldexpl)
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)
+#else
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)
+#endif
+
+#if defined(frexpf)
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)
+#else
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)
+#endif
+
+#if defined(frexpl)
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)
+#else
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)
+#endif
+
+#undef BOOST_HASH_CALL_FLOAT_MACRO
+#undef BOOST_HASH_CALL_FLOAT_FUNC
+
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        template <typename Float1, typename Float2>
+        struct select_hash_type_impl {
+            typedef double type;
+        };
+
+        template <>
+        struct select_hash_type_impl<float, float> {
+            typedef float type;
+        };
+
+        template <>
+        struct select_hash_type_impl<long double, long double> {
+            typedef long double type;
+        };
+
+
+        // select_hash_type
+        //
+        // If there is support for a particular floating point type, use that
+        // otherwise use double (there's always support for double).
+             
+        template <typename Float>
+        struct select_hash_type : select_hash_type_impl<
+                BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,
+                BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type
+            > {};            
+    }
+}
+
+#endif // BOOST_HASH_CONFORMANT_FLOATS
+
+#endif
diff --git a/ndnboost/functional/hash/detail/hash_float.hpp b/ndnboost/functional/hash/detail/hash_float.hpp
new file mode 100644
index 0000000..c15a139
--- /dev/null
+++ b/ndnboost/functional/hash/detail/hash_float.hpp
@@ -0,0 +1,277 @@
+
+// Copyright 2005-2012 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)
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/functional/hash/detail/float_functions.hpp>
+#include <ndnboost/functional/hash/detail/limits.hpp>
+#include <ndnboost/utility/enable_if.hpp>
+#include <ndnboost/integer/static_log2.hpp>
+#include <ndnboost/cstdint.hpp>
+#include <ndnboost/assert.hpp>
+#include <ndnboost/limits.hpp>
+#include <cstring>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC >= 1400
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
+                              // not satisfy test. Loop body not executed
+#endif
+#endif
+
+// Can we use fpclassify?
+
+// STLport
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+#define BOOST_HASH_USE_FPCLASSIFY 0
+
+// GNU libstdc++ 3
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+#  if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
+      !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+#    define BOOST_HASH_USE_FPCLASSIFY 1
+#  else
+#    define BOOST_HASH_USE_FPCLASSIFY 0
+#  endif
+
+// Everything else
+#else
+#  define BOOST_HASH_USE_FPCLASSIFY 0
+#endif
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        inline void hash_float_combine(std::size_t& seed, std::size_t value)
+        {
+            seed ^= value + (seed<<6) + (seed>>2);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Binary hash function
+        //
+        // Only used for floats with known iec559 floats, and certain values in
+        // numeric_limits
+
+        inline std::size_t hash_binary(char* ptr, std::size_t length)
+        {
+            std::size_t seed = 0;
+
+            if (length >= sizeof(std::size_t)) {
+                seed = *(std::size_t*) ptr;
+                length -= sizeof(std::size_t);
+                ptr += sizeof(std::size_t);
+
+                while(length >= sizeof(std::size_t)) {
+                    std::size_t buffer = 0;
+                    std::memcpy(&buffer, ptr, sizeof(std::size_t));
+                    hash_float_combine(seed, buffer);
+                    length -= sizeof(std::size_t);
+                    ptr += sizeof(std::size_t);
+                }
+            }
+
+            if (length > 0) {
+                std::size_t buffer = 0;
+                std::memcpy(&buffer, ptr, length);
+                hash_float_combine(seed, buffer);
+            }
+
+            return seed;
+        }
+
+        template <typename Float>
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME ndnboost::enable_if_c<
+                std::numeric_limits<Float>::is_iec559 &&
+                std::numeric_limits<Float>::digits == 24 &&
+                std::numeric_limits<Float>::radix == 2 &&
+                std::numeric_limits<Float>::max_exponent == 128,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 4);
+        }
+
+
+        template <typename Float>
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME ndnboost::enable_if_c<
+                std::numeric_limits<Float>::is_iec559 &&
+                std::numeric_limits<Float>::digits == 53 &&
+                std::numeric_limits<Float>::radix == 2 &&
+                std::numeric_limits<Float>::max_exponent == 1024,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 8);
+        }
+
+        template <typename Float>
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME ndnboost::enable_if_c<
+                std::numeric_limits<Float>::is_iec559 &&
+                std::numeric_limits<Float>::digits == 64 &&
+                std::numeric_limits<Float>::radix == 2 &&
+                std::numeric_limits<Float>::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 10);
+        }
+
+        template <typename Float>
+        inline std::size_t float_hash_impl(Float v,
+            BOOST_DEDUCED_TYPENAME ndnboost::enable_if_c<
+                std::numeric_limits<Float>::is_iec559 &&
+                std::numeric_limits<Float>::digits == 113 &&
+                std::numeric_limits<Float>::radix == 2 &&
+                std::numeric_limits<Float>::max_exponent == 16384,
+                int>::type
+            )
+        {
+            return hash_binary((char*) &v, 16);
+        }
+
+        ////////////////////////////////////////////////////////////////////////
+        // Portable hash function
+        //
+        // Used as a fallback when the binary hash function isn't supported.
+
+        template <class T>
+        inline std::size_t float_hash_impl2(T v)
+        {
+            ndnboost::hash_detail::call_frexp<T> frexp;
+            ndnboost::hash_detail::call_ldexp<T> ldexp;
+
+            int exp = 0;
+
+            v = frexp(v, &exp);
+
+            // A postive value is easier to hash, so combine the
+            // sign with the exponent and use the absolute value.
+            if(v < 0) {
+                v = -v;
+                exp += limits<T>::max_exponent -
+                    limits<T>::min_exponent;
+            }
+
+            v = ldexp(v, limits<std::size_t>::digits);
+            std::size_t seed = static_cast<std::size_t>(v);
+            v -= static_cast<T>(seed);
+
+            // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
+            std::size_t const length
+                = (limits<T>::digits *
+                        ndnboost::static_log2<limits<T>::radix>::value
+                        + limits<std::size_t>::digits - 1)
+                / limits<std::size_t>::digits;
+
+            for(std::size_t i = 0; i != length; ++i)
+            {
+                v = ldexp(v, limits<std::size_t>::digits);
+                std::size_t part = static_cast<std::size_t>(v);
+                v -= static_cast<T>(part);
+                hash_float_combine(seed, part);
+            }
+
+            hash_float_combine(seed, exp);
+
+            return seed;
+        }
+
+#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC)
+        template <class T>
+        inline std::size_t float_hash_impl(T v, ...)
+        {
+            typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
+            return float_hash_impl2(static_cast<type>(v));
+        }
+#endif
+    }
+}
+
+#if BOOST_HASH_USE_FPCLASSIFY
+
+#include <ndnboost/config/no_tr1/cmath.hpp>
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        template <class T>
+        inline std::size_t float_hash_value(T v)
+        {
+#if defined(fpclassify)
+            switch (fpclassify(v))
+#elif BOOST_HASH_CONFORMANT_FLOATS
+            switch (std::fpclassify(v))
+#else
+            using namespace std;
+            switch (fpclassify(v))
+#endif
+            {
+            case FP_ZERO:
+                return 0;
+            case FP_INFINITE:
+                return (std::size_t)(v > 0 ? -1 : -2);
+            case FP_NAN:
+                return (std::size_t)(-3);
+            case FP_NORMAL:
+            case FP_SUBNORMAL:
+                return float_hash_impl(v, 0);
+            default:
+                BOOST_ASSERT(0);
+                return 0;
+            }
+        }
+    }
+}
+
+#else // !BOOST_HASH_USE_FPCLASSIFY
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        template <class T>
+        inline bool is_zero(T v)
+        {
+#if !defined(__GNUC__)
+            return v == 0;
+#else
+            // GCC's '-Wfloat-equal' will complain about comparing
+            // v to 0, but because it disables warnings for system
+            // headers it won't complain if you use std::equal_to to
+            // compare with 0. Resulting in this silliness:
+            return std::equal_to<T>()(v, 0);
+#endif
+        }
+
+        template <class T>
+        inline std::size_t float_hash_value(T v)
+        {
+            return ndnboost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0);
+        }
+    }
+}
+
+#endif // BOOST_HASH_USE_FPCLASSIFY
+
+#undef BOOST_HASH_USE_FPCLASSIFY
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/ndnboost/functional/hash/detail/limits.hpp b/ndnboost/functional/hash/detail/limits.hpp
new file mode 100644
index 0000000..aff26da
--- /dev/null
+++ b/ndnboost/functional/hash/detail/limits.hpp
@@ -0,0 +1,61 @@
+
+// Copyright 2005-2009 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)
+//
+// On some platforms std::limits gives incorrect values for long double.
+// This tries to work around them.
+
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
+#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/limits.hpp>
+
+// On OpenBSD, numeric_limits is not reliable for long doubles, but
+// the macros defined in <float.h> are and support long double when STLport
+// doesn't.
+
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
+#include <float.h>
+#endif
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        template <class T>
+        struct limits : std::numeric_limits<T> {};
+
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
+        template <>
+        struct limits<long double>
+             : std::numeric_limits<long double>
+        {
+            static long double epsilon() {
+                return LDBL_EPSILON;
+            }
+
+            static long double (max)() {
+                return LDBL_MAX;
+            }
+
+            static long double (min)() {
+                return LDBL_MIN;
+            }
+
+            BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
+            BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
+            BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
+#if defined(_STLP_NO_LONG_DOUBLE)
+            BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);
+#endif
+        };
+#endif // __OpenBSD__
+    }
+}
+
+#endif
diff --git a/ndnboost/functional/hash/extensions.hpp b/ndnboost/functional/hash/extensions.hpp
new file mode 100644
index 0000000..119043b
--- /dev/null
+++ b/ndnboost/functional/hash/extensions.hpp
@@ -0,0 +1,379 @@
+
+// Copyright 2005-2009 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)
+
+//  Based on Peter Dimov's proposal
+//  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
+//  issue 6.18. 
+
+// This implements the extensions to the standard.
+// It's undocumented, so you shouldn't use it....
+
+#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
+#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
+
+#include <ndnboost/functional/hash/hash.hpp>
+#include <ndnboost/detail/container_fwd.hpp>
+#include <ndnboost/utility/enable_if.hpp>
+#include <ndnboost/static_assert.hpp>
+#include <ndnboost/preprocessor/repetition/repeat_from_to.hpp>
+#include <ndnboost/preprocessor/repetition/enum_params.hpp>
+
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+#   include <array>
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+#   include <tuple>
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
+#   include <memory>
+#endif
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+#include <ndnboost/type_traits/is_array.hpp>
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#include <ndnboost/type_traits/is_const.hpp>
+#endif
+
+namespace ndnboost
+{
+    template <class A, class B>
+    std::size_t hash_value(std::pair<A, B> const&);
+    template <class T, class A>
+    std::size_t hash_value(std::vector<T, A> const&);
+    template <class T, class A>
+    std::size_t hash_value(std::list<T, A> const& v);
+    template <class T, class A>
+    std::size_t hash_value(std::deque<T, A> const& v);
+    template <class K, class C, class A>
+    std::size_t hash_value(std::set<K, C, A> const& v);
+    template <class K, class C, class A>
+    std::size_t hash_value(std::multiset<K, C, A> const& v);
+    template <class K, class T, class C, class A>
+    std::size_t hash_value(std::map<K, T, C, A> const& v);
+    template <class K, class T, class C, class A>
+    std::size_t hash_value(std::multimap<K, T, C, A> const& v);
+
+    template <class T>
+    std::size_t hash_value(std::complex<T> const&);
+
+    template <class A, class B>
+    std::size_t hash_value(std::pair<A, B> const& v)
+    {
+        std::size_t seed = 0;
+        ndnboost::hash_combine(seed, v.first);
+        ndnboost::hash_combine(seed, v.second);
+        return seed;
+    }
+
+    template <class T, class A>
+    std::size_t hash_value(std::vector<T, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class T, class A>
+    std::size_t hash_value(std::list<T, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class T, class A>
+    std::size_t hash_value(std::deque<T, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class K, class C, class A>
+    std::size_t hash_value(std::set<K, C, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class K, class C, class A>
+    std::size_t hash_value(std::multiset<K, C, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class K, class T, class C, class A>
+    std::size_t hash_value(std::map<K, T, C, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class K, class T, class C, class A>
+    std::size_t hash_value(std::multimap<K, T, C, A> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+
+    template <class T>
+    std::size_t hash_value(std::complex<T> const& v)
+    {
+        ndnboost::hash<T> hasher;
+        std::size_t seed = hasher(v.imag());
+        seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
+        return seed;
+    }
+
+#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
+    template <class T, std::size_t N>
+    std::size_t hash_value(std::array<T, N> const& v)
+    {
+        return ndnboost::hash_range(v.begin(), v.end());
+    }
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
+    namespace hash_detail {
+        template <std::size_t I, typename T>
+        inline typename ndnboost::enable_if_c<(I == std::tuple_size<T>::value),
+                void>::type
+            hash_combine_tuple(std::size_t&, T const&)
+        {
+        }
+
+        template <std::size_t I, typename T>
+        inline typename ndnboost::enable_if_c<(I < std::tuple_size<T>::value),
+                void>::type
+            hash_combine_tuple(std::size_t& seed, T const& v)
+        {
+            ndnboost::hash_combine(seed, std::get<I>(v));
+            ndnboost::hash_detail::hash_combine_tuple<I + 1>(seed, v);
+        }
+
+        template <typename T>
+        inline std::size_t hash_tuple(T const& v)
+        {
+            std::size_t seed = 0;
+            ndnboost::hash_detail::hash_combine_tuple<0>(seed, v);
+            return seed;
+        }
+    }
+
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+    template <typename... T>
+    inline std::size_t hash_value(std::tuple<T...> const& v)
+    {
+        return ndnboost::hash_detail::hash_tuple(v);
+    }
+#else
+
+    inline std::size_t hash_value(std::tuple<> const& v)
+    {
+        return ndnboost::hash_detail::hash_tuple(v);
+    }
+
+#   define BOOST_HASH_TUPLE_F(z, n, _)                                      \
+    template<                                                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)                            \
+    >                                                                       \
+    inline std::size_t hash_value(std::tuple<                               \
+        BOOST_PP_ENUM_PARAMS_Z(z, n, A)                                     \
+    > const& v)                                                             \
+    {                                                                       \
+        return ndnboost::hash_detail::hash_tuple(v);                           \
+    }
+
+    BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _)
+#   undef BOOST_HASH_TUPLE_F
+#endif
+
+#endif
+
+#if !defined(BOOST_NO_CXX11_SMART_PTR)
+    template <typename T>
+    inline std::size_t hash_value(std::shared_ptr<T> const& x) {
+        return ndnboost::hash_value(x.get());
+    }
+
+    template <typename T, typename Deleter>
+    inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) {
+        return ndnboost::hash_value(x.get());
+    }
+#endif
+
+    //
+    // call_hash_impl
+    //
+
+    // On compilers without function template ordering, this deals with arrays.
+
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+    namespace hash_detail
+    {
+        template <bool IsArray>
+        struct call_hash_impl
+        {
+            template <class T>
+            struct inner
+            {
+                static std::size_t call(T const& v)
+                {
+                    using namespace ndnboost;
+                    return hash_value(v);
+                }
+            };
+        };
+
+        template <>
+        struct call_hash_impl<true>
+        {
+            template <class Array>
+            struct inner
+            {
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+                static std::size_t call(Array const& v)
+#else
+                static std::size_t call(Array& v)
+#endif
+                {
+                    const int size = sizeof(v) / sizeof(*v);
+                    return ndnboost::hash_range(v, v + size);
+                }
+            };
+        };
+
+        template <class T>
+        struct call_hash
+            : public call_hash_impl<ndnboost::is_array<T>::value>
+                ::BOOST_NESTED_TEMPLATE inner<T>
+        {
+        };
+    }
+#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+    //
+    // ndnboost::hash
+    //
+
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
+    template <class T> struct hash
+        : std::unary_function<T, std::size_t>
+    {
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+        std::size_t operator()(T const& val) const
+        {
+            return hash_value(val);
+        }
+#else
+        std::size_t operator()(T const& val) const
+        {
+            return hash_detail::call_hash<T>::call(val);
+        }
+#endif
+    };
+
+#if BOOST_WORKAROUND(__DMC__, <= 0x848)
+    template <class T, unsigned int n> struct hash<T[n]>
+        : std::unary_function<T[n], std::size_t>
+    {
+        std::size_t operator()(const T* val) const
+        {
+            return ndnboost::hash_range(val, val+n);
+        }
+    };
+#endif
+
+#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+    // On compilers without partial specialization, ndnboost::hash<T>
+    // has already been declared to deal with pointers, so just
+    // need to supply the non-pointer version of hash_impl.
+
+    namespace hash_detail
+    {
+        template <bool IsPointer>
+        struct hash_impl;
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+
+        template <>
+        struct hash_impl<false>
+        {
+            template <class T>
+            struct inner
+                : std::unary_function<T, std::size_t>
+            {
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+                std::size_t operator()(T const& val) const
+                {
+                    return hash_value(val);
+                }
+#else
+                std::size_t operator()(T const& val) const
+                {
+                    return hash_detail::call_hash<T>::call(val);
+                }
+#endif
+            };
+        };
+
+#else // Visual C++ 6.5
+
+        // Visual C++ 6.5 has problems with nested member functions and
+        // applying const to const types in templates. So we get this:
+
+        template <bool IsConst>
+        struct hash_impl_msvc
+        {
+            template <class T>
+            struct inner
+                : public std::unary_function<T, std::size_t>
+            {
+                std::size_t operator()(T const& val) const
+                {
+                    return hash_detail::call_hash<T const>::call(val);
+                }
+
+                std::size_t operator()(T& val) const
+                {
+                    return hash_detail::call_hash<T>::call(val);
+                }
+            };
+        };
+
+        template <>
+        struct hash_impl_msvc<true>
+        {
+            template <class T>
+            struct inner
+                : public std::unary_function<T, std::size_t>
+            {
+                std::size_t operator()(T& val) const
+                {
+                    return hash_detail::call_hash<T>::call(val);
+                }
+            };
+        };
+        
+        template <class T>
+        struct hash_impl_msvc2
+            : public hash_impl_msvc<ndnboost::is_const<T>::value>
+                    ::BOOST_NESTED_TEMPLATE inner<T> {};
+        
+        template <>
+        struct hash_impl<false>
+        {
+            template <class T>
+            struct inner : public hash_impl_msvc2<T> {};
+        };
+
+#endif // Visual C++ 6.5
+    }
+#endif  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+}
+
+#endif
diff --git a/ndnboost/functional/hash/hash.hpp b/ndnboost/functional/hash/hash.hpp
new file mode 100644
index 0000000..c61793c
--- /dev/null
+++ b/ndnboost/functional/hash/hash.hpp
@@ -0,0 +1,530 @@
+
+// Copyright 2005-2009 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)
+
+//  Based on Peter Dimov's proposal
+//  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
+//  issue 6.18. 
+
+#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP)
+#define BOOST_FUNCTIONAL_HASH_HASH_HPP
+
+#include <ndnboost/functional/hash/hash_fwd.hpp>
+#include <functional>
+#include <ndnboost/functional/hash/detail/hash_float.hpp>
+#include <string>
+#include <ndnboost/limits.hpp>
+#include <ndnboost/type_traits/is_enum.hpp>
+#include <ndnboost/type_traits/is_integral.hpp>
+#include <ndnboost/utility/enable_if.hpp>
+
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#include <ndnboost/type_traits/is_pointer.hpp>
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+#include <typeindex>
+#endif
+
+#if BOOST_WORKAROUND(__GNUC__, < 3) \
+    && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+#define BOOST_HASH_CHAR_TRAITS string_char_traits
+#else
+#define BOOST_HASH_CHAR_TRAITS char_traits
+#endif
+
+namespace ndnboost
+{
+    namespace hash_detail
+    {
+        struct enable_hash_value { typedef std::size_t type; };
+
+        template <typename T> struct basic_numbers {};
+        template <typename T> struct long_numbers;
+        template <typename T> struct ulong_numbers;
+        template <typename T> struct float_numbers {};
+
+        template <> struct basic_numbers<bool> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<char> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<unsigned char> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<signed char> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<short> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<unsigned short> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<int> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<unsigned int> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<long> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct basic_numbers<unsigned long> :
+            ndnboost::hash_detail::enable_hash_value {};
+
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+        template <> struct basic_numbers<wchar_t> :
+            ndnboost::hash_detail::enable_hash_value {};
+#endif
+
+        // long_numbers is defined like this to allow for separate
+        // specialization for long_long and int128_type, in case
+        // they conflict.
+        template <typename T> struct long_numbers2 {};
+        template <typename T> struct ulong_numbers2 {};
+        template <typename T> struct long_numbers : long_numbers2<T> {};
+        template <typename T> struct ulong_numbers : ulong_numbers2<T> {};
+
+#if !defined(BOOST_NO_LONG_LONG)
+        template <> struct long_numbers<ndnboost::long_long_type> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers<ndnboost::ulong_long_type> :
+            ndnboost::hash_detail::enable_hash_value {};
+#endif
+
+#if defined(BOOST_HAS_INT128)
+        template <> struct long_numbers2<ndnboost::int128_type> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct ulong_numbers2<ndnboost::uint128_type> :
+            ndnboost::hash_detail::enable_hash_value {};
+#endif
+
+        template <> struct float_numbers<float> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers<double> :
+            ndnboost::hash_detail::enable_hash_value {};
+        template <> struct float_numbers<long double> :
+            ndnboost::hash_detail::enable_hash_value {};
+    }
+
+    template <typename T>
+    typename ndnboost::hash_detail::basic_numbers<T>::type hash_value(T);
+    template <typename T>
+    typename ndnboost::hash_detail::long_numbers<T>::type hash_value(T);
+    template <typename T>
+    typename ndnboost::hash_detail::ulong_numbers<T>::type hash_value(T);
+
+    template <typename T>
+    typename ndnboost::enable_if<ndnboost::is_enum<T>, std::size_t>::type
+        hash_value(T);
+
+#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
+    template <class T> std::size_t hash_value(T* const&);
+#else
+    template <class T> std::size_t hash_value(T*);
+#endif
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+    template< class T, unsigned N >
+    std::size_t hash_value(const T (&x)[N]);
+
+    template< class T, unsigned N >
+    std::size_t hash_value(T (&x)[N]);
+#endif
+
+    template <class Ch, class A>
+    std::size_t hash_value(
+        std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
+
+    template <typename T>
+    typename ndnboost::hash_detail::float_numbers<T>::type hash_value(T);
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+    std::size_t hash_value(std::type_index);
+#endif
+
+    // Implementation
+
+    namespace hash_detail
+    {
+        template <class T>
+        inline std::size_t hash_value_signed(T val)
+        {
+             const int size_t_bits = std::numeric_limits<std::size_t>::digits;
+             // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
+             const int length = (std::numeric_limits<T>::digits - 1)
+                 / size_t_bits;
+
+             std::size_t seed = 0;
+             T positive = val < 0 ? -1 - val : val;
+
+             // Hopefully, this loop can be unrolled.
+             for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
+             {
+                 seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
+             }
+             seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
+
+             return seed;
+        }
+
+        template <class T>
+        inline std::size_t hash_value_unsigned(T val)
+        {
+             const int size_t_bits = std::numeric_limits<std::size_t>::digits;
+             // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
+             const int length = (std::numeric_limits<T>::digits - 1)
+                 / size_t_bits;
+
+             std::size_t seed = 0;
+
+             // Hopefully, this loop can be unrolled.
+             for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
+             {
+                 seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
+             }
+             seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
+
+             return seed;
+        }
+    }
+
+    template <typename T>
+    typename ndnboost::hash_detail::basic_numbers<T>::type hash_value(T v)
+    {
+        return static_cast<std::size_t>(v);
+    }
+
+    template <typename T>
+    typename ndnboost::hash_detail::long_numbers<T>::type hash_value(T v)
+    {
+        return hash_detail::hash_value_signed(v);
+    }
+
+    template <typename T>
+    typename ndnboost::hash_detail::ulong_numbers<T>::type hash_value(T v)
+    {
+        return hash_detail::hash_value_unsigned(v);
+    }
+
+    template <typename T>
+    typename ndnboost::enable_if<ndnboost::is_enum<T>, std::size_t>::type
+        hash_value(T v)
+    {
+        return static_cast<std::size_t>(v);
+    }
+
+    // Implementation by Alberto Barbati and Dave Harris.
+#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
+    template <class T> std::size_t hash_value(T* const& v)
+#else
+    template <class T> std::size_t hash_value(T* v)
+#endif
+    {
+#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
+    // for some reason ptrdiff_t on OpenVMS compiler with
+    // 64 bit is not 64 bit !!!
+        std::size_t x = static_cast<std::size_t>(
+           reinterpret_cast<long long int>(v));
+#else
+        std::size_t x = static_cast<std::size_t>(
+           reinterpret_cast<std::ptrdiff_t>(v));
+#endif
+        return x + (x >> 3);
+    }
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC <= 1400
+#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
+                              // 'unsigned int', possible loss of data
+                              // A misguided attempt to detect 64-bit
+                              // incompatability.
+#endif
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+    template <class T>
+    inline void hash_combine(std::size_t& seed, T& v)
+#else
+    template <class T>
+    inline void hash_combine(std::size_t& seed, T const& v)
+#endif
+    {
+        ndnboost::hash<T> hasher;
+        seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+    }
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+    template <class It>
+    inline std::size_t hash_range(It first, It last)
+    {
+        std::size_t seed = 0;
+
+        for(; first != last; ++first)
+        {
+            hash_combine(seed, *first);
+        }
+
+        return seed;
+    }
+
+    template <class It>
+    inline void hash_range(std::size_t& seed, It first, It last)
+    {
+        for(; first != last; ++first)
+        {
+            hash_combine(seed, *first);
+        }
+    }
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+    template <class T>
+    inline std::size_t hash_range(T* first, T* last)
+    {
+        std::size_t seed = 0;
+
+        for(; first != last; ++first)
+        {
+            ndnboost::hash<T> hasher;
+            seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+        }
+
+        return seed;
+    }
+
+    template <class T>
+    inline void hash_range(std::size_t& seed, T* first, T* last)
+    {
+        for(; first != last; ++first)
+        {
+            ndnboost::hash<T> hasher;
+            seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+        }
+    }
+#endif
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+    template< class T, unsigned N >
+    inline std::size_t hash_value(const T (&x)[N])
+    {
+        return hash_range(x, x + N);
+    }
+
+    template< class T, unsigned N >
+    inline std::size_t hash_value(T (&x)[N])
+    {
+        return hash_range(x, x + N);
+    }
+#endif
+
+    template <class Ch, class A>
+    inline std::size_t hash_value(
+        std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
+    {
+        return hash_range(v.begin(), v.end());
+    }
+
+    template <typename T>
+    typename ndnboost::hash_detail::float_numbers<T>::type hash_value(T v)
+    {
+        return ndnboost::hash_detail::float_hash_value(v);
+    }
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+    inline std::size_t hash_value(std::type_index v)
+    {
+        return v.hash_code();
+    }
+#endif
+
+    //
+    // ndnboost::hash
+    //
+    
+    // Define the specializations required by the standard. The general purpose
+    // ndnboost::hash is defined later in extensions.hpp if
+    // BOOST_HASH_NO_EXTENSIONS is not defined.
+    
+    // BOOST_HASH_SPECIALIZE - define a specialization for a type which is
+    // passed by copy.
+    //
+    // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is
+    // passed by copy.
+    //
+    // These are undefined later.
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#define BOOST_HASH_SPECIALIZE(type) \
+    template <> struct hash<type> \
+         : public std::unary_function<type, std::size_t> \
+    { \
+        std::size_t operator()(type v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    };
+
+#define BOOST_HASH_SPECIALIZE_REF(type) \
+    template <> struct hash<type> \
+         : public std::unary_function<type, std::size_t> \
+    { \
+        std::size_t operator()(type const& v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    };
+#else
+#define BOOST_HASH_SPECIALIZE(type) \
+    template <> struct hash<type> \
+         : public std::unary_function<type, std::size_t> \
+    { \
+        std::size_t operator()(type v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    }; \
+    \
+    template <> struct hash<const type> \
+         : public std::unary_function<const type, std::size_t> \
+    { \
+        std::size_t operator()(const type v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    };
+
+#define BOOST_HASH_SPECIALIZE_REF(type) \
+    template <> struct hash<type> \
+         : public std::unary_function<type, std::size_t> \
+    { \
+        std::size_t operator()(type const& v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    }; \
+    \
+    template <> struct hash<const type> \
+         : public std::unary_function<const type, std::size_t> \
+    { \
+        std::size_t operator()(type const& v) const \
+        { \
+            return ndnboost::hash_value(v); \
+        } \
+    };
+#endif
+
+    BOOST_HASH_SPECIALIZE(bool)
+    BOOST_HASH_SPECIALIZE(char)
+    BOOST_HASH_SPECIALIZE(signed char)
+    BOOST_HASH_SPECIALIZE(unsigned char)
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+    BOOST_HASH_SPECIALIZE(wchar_t)
+#endif
+    BOOST_HASH_SPECIALIZE(short)
+    BOOST_HASH_SPECIALIZE(unsigned short)
+    BOOST_HASH_SPECIALIZE(int)
+    BOOST_HASH_SPECIALIZE(unsigned int)
+    BOOST_HASH_SPECIALIZE(long)
+    BOOST_HASH_SPECIALIZE(unsigned long)
+
+    BOOST_HASH_SPECIALIZE(float)
+    BOOST_HASH_SPECIALIZE(double)
+    BOOST_HASH_SPECIALIZE(long double)
+
+    BOOST_HASH_SPECIALIZE_REF(std::string)
+#if !defined(BOOST_NO_STD_WSTRING)
+    BOOST_HASH_SPECIALIZE_REF(std::wstring)
+#endif
+
+#if !defined(BOOST_NO_LONG_LONG)
+    BOOST_HASH_SPECIALIZE(ndnboost::long_long_type)
+    BOOST_HASH_SPECIALIZE(ndnboost::ulong_long_type)
+#endif
+
+#if defined(BOOST_HAS_INT128)
+    BOOST_HASH_SPECIALIZE(ndnboost::int128_type)
+    BOOST_HASH_SPECIALIZE(ndnboost::uint128_type)
+#endif
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+    BOOST_HASH_SPECIALIZE(std::type_index)
+#endif
+
+#undef BOOST_HASH_SPECIALIZE
+#undef BOOST_HASH_SPECIALIZE_REF
+
+// Specializing ndnboost::hash for pointers.
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
+    template <class T>
+    struct hash<T*>
+        : public std::unary_function<T*, std::size_t>
+    {
+        std::size_t operator()(T* v) const
+        {
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
+            return ndnboost::hash_value(v);
+#else
+            std::size_t x = static_cast<std::size_t>(
+                reinterpret_cast<std::ptrdiff_t>(v));
+
+            return x + (x >> 3);
+#endif
+        }
+    };
+
+#else
+
+    // For compilers without partial specialization, we define a
+    // ndnboost::hash for all remaining types. But hash_impl is only defined
+    // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
+    // is defined there will still be a compile error for types not supported
+    // in the standard.
+
+    namespace hash_detail
+    {
+        template <bool IsPointer>
+        struct hash_impl;
+
+        template <>
+        struct hash_impl<true>
+        {
+            template <class T>
+            struct inner
+                : public std::unary_function<T, std::size_t>
+            {
+                std::size_t operator()(T val) const
+                {
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
+                    return ndnboost::hash_value(val);
+#else
+                    std::size_t x = static_cast<std::size_t>(
+                        reinterpret_cast<std::ptrdiff_t>(val));
+
+                    return x + (x >> 3);
+#endif
+                }
+            };
+        };
+    }
+
+    template <class T> struct hash
+        : public ndnboost::hash_detail::hash_impl<ndnboost::is_pointer<T>::value>
+            ::BOOST_NESTED_TEMPLATE inner<T>
+    {
+    };
+
+#endif
+}
+
+#undef BOOST_HASH_CHAR_TRAITS
+
+#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
+
+// Include this outside of the include guards in case the file is included
+// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
+// undefined.
+
+#if !defined(BOOST_HASH_NO_EXTENSIONS) \
+    && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
+#include <ndnboost/functional/hash/extensions.hpp>
+#endif
diff --git a/ndnboost/functional/hash/hash_fwd.hpp b/ndnboost/functional/hash/hash_fwd.hpp
new file mode 100644
index 0000000..06babfb
--- /dev/null
+++ b/ndnboost/functional/hash/hash_fwd.hpp
@@ -0,0 +1,40 @@
+
+// Copyright 2005-2009 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)
+
+//  Based on Peter Dimov's proposal
+//  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
+//  issue 6.18. 
+
+#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)
+#define BOOST_FUNCTIONAL_HASH_FWD_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/config.hpp>
+#include <cstddef>
+#include <ndnboost/detail/workaround.hpp>
+
+namespace ndnboost
+{
+    template <class T> struct hash;
+
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+    template <class T> void hash_combine(std::size_t& seed, T& v);
+#else
+    template <class T> void hash_combine(std::size_t& seed, T const& v);
+#endif
+
+    template <class It> std::size_t hash_range(It, It);
+    template <class It> void hash_range(std::size_t&, It, It);
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+    template <class T> inline std::size_t hash_range(T*, T*);
+    template <class T> inline void hash_range(std::size_t&, T*, T*);
+#endif
+}
+
+#endif
diff --git a/ndnboost/functional/hash_fwd.hpp b/ndnboost/functional/hash_fwd.hpp
new file mode 100644
index 0000000..db93d0b
--- /dev/null
+++ b/ndnboost/functional/hash_fwd.hpp
@@ -0,0 +1,7 @@
+
+// Copyright 2005-2009 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)
+
+#include <ndnboost/functional/hash/hash_fwd.hpp>
+
diff --git a/ndnboost/functional/lightweight_forward_adapter.hpp b/ndnboost/functional/lightweight_forward_adapter.hpp
new file mode 100644
index 0000000..8312a2c
--- /dev/null
+++ b/ndnboost/functional/lightweight_forward_adapter.hpp
@@ -0,0 +1,259 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    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).
+==============================================================================*/
+
+#ifndef BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_HPP_INCLUDED
+#   ifndef BOOST_PP_IS_ITERATING
+
+#   include <ndnboost/config.hpp>
+#   include <ndnboost/detail/workaround.hpp>
+
+#   include <ndnboost/preprocessor/cat.hpp>
+#   include <ndnboost/preprocessor/iteration/iterate.hpp>
+#   include <ndnboost/preprocessor/repetition/enum.hpp>
+#   include <ndnboost/preprocessor/repetition/enum_params.hpp>
+#   include <ndnboost/preprocessor/repetition/enum_binary_params.hpp>
+#   include <ndnboost/preprocessor/facilities/intercept.hpp>
+
+#   include <ndnboost/utility/result_of.hpp>
+#   include <ndnboost/ref.hpp>
+
+#   ifndef BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY
+#     define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY 10
+#   elif BOOST_FUNCTIONAL_FORDWARD_ADAPTER_MAX_ARITY < 3
+#     undef  BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY
+#     define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY 3
+#   endif
+
+namespace ndnboost 
+{
+    template< typename Function, int Arity_Or_MinArity = -1, int MaxArity = -1 >
+    class lightweight_forward_adapter;
+
+    //----- ---- --- -- - -  -   -
+
+    namespace detail
+    {
+        template< class MostDerived, typename Function, typename FunctionConst, 
+            int Arity, int MinArity >
+        struct lightweight_forward_adapter_impl;
+
+        struct lightweight_forward_adapter_result
+        {
+            template< typename Sig > struct apply;
+
+            // Utility metafunction for argument transform
+            template< typename T > struct x  { typedef T const& t; };
+            template< typename T > struct x< ndnboost::reference_wrapper<T> >
+            { typedef T& t; };
+            template< typename T > struct x<T&>       : x<T> { };
+            template< typename T > struct x<T const&> : x<T> { };
+            template< typename T > struct x<T const>  : x<T> { };
+
+            // Utility metafunction to choose target function qualification
+            template< typename T > struct c
+            { typedef typename T::target_function_t t; };
+            template< typename T > struct c<T&      >
+            { typedef typename T::target_function_t t; };
+            template< typename T > struct c<T const >
+            { typedef typename T::target_function_const_t t; };
+            template< typename T > struct c<T const&>
+            { typedef typename T::target_function_const_t t; };
+        };
+    }
+
+#   define BOOST_TMP_MACRO(f,fn,fc) \
+        ndnboost::detail::lightweight_forward_adapter_impl< \
+            lightweight_forward_adapter<f,Arity_Or_MinArity,MaxArity>, fn, fc, \
+            (MaxArity!=-1? MaxArity :Arity_Or_MinArity!=-1? Arity_Or_MinArity \
+                :BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY), \
+            (Arity_Or_MinArity!=-1? Arity_Or_MinArity : 0) >
+
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class lightweight_forward_adapter
+        : public BOOST_TMP_MACRO(Function,Function,Function const)
+        , private Function
+    {
+      public:
+        lightweight_forward_adapter(Function const& f = Function()) 
+          : Function(f) 
+        { }
+
+        typedef Function        target_function_t;
+        typedef Function const  target_function_const_t;
+
+        Function       & target_function()       { return *this; }
+        Function const & target_function() const { return *this; }
+
+        template< typename Sig > struct result
+            : detail::lightweight_forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function,Function, Function const)::operator();
+    };
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class lightweight_forward_adapter< Function const, Arity_Or_MinArity, 
+        MaxArity >
+        : public BOOST_TMP_MACRO(Function const, Function const, Function const)
+        , private Function
+    {
+      public:
+        lightweight_forward_adapter(Function const& f = Function())
+          : Function(f) 
+        { }
+
+        typedef Function const target_function_t;
+        typedef Function const target_function_const_t;
+
+        Function const & target_function() const { return *this; }
+
+        template< typename Sig > struct result
+            : detail::lightweight_forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function const,Function const, Function const)
+            ::operator();
+    };
+    template< typename Function, int Arity_Or_MinArity, int MaxArity >
+    class lightweight_forward_adapter< Function &, Arity_Or_MinArity, MaxArity >
+        : public BOOST_TMP_MACRO(Function&, Function, Function)
+    {
+        Function& ref_function;
+      public:
+        lightweight_forward_adapter(Function& f)
+          : ref_function(f) 
+        { }
+
+        typedef Function target_function_t;
+        typedef Function target_function_const_t;
+
+        Function & target_function() const { return this->ref_function; }
+
+        template< typename Sig > struct result
+            : detail::lightweight_forward_adapter_result::template apply<Sig>
+        { };
+
+        using BOOST_TMP_MACRO(Function&, Function, Function)::operator();
+    }; 
+
+    #undef BOOST_TMP_MACRO
+
+    namespace detail
+    {
+        template< class Self >
+        struct lightweight_forward_adapter_result::apply< Self() >
+            : ndnboost::result_of< BOOST_DEDUCED_TYPENAME c<Self>::t() >
+        { };
+
+        template< class MD, class F, class FC >
+        struct lightweight_forward_adapter_impl<MD,F,FC,0,0>
+            : lightweight_forward_adapter_result
+        {
+            inline typename ndnboost::result_of< FC() >::type
+            operator()() const
+            {
+                return static_cast<MD const*>(this)->target_function()();
+            }
+
+            inline typename ndnboost::result_of< F() >::type
+            operator()()
+            {
+                return static_cast<MD*>(this)->target_function()();
+            }
+        };
+
+#       define  BOOST_PP_FILENAME_1 \
+            <ndnboost/functional/lightweight_forward_adapter.hpp>
+#       define  BOOST_PP_ITERATION_LIMITS                                     \
+            (1,BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY) 
+#       include BOOST_PP_ITERATE()
+
+    } // namespace detail
+
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::lightweight_forward_adapter<F,A0,A1> const ()>
+        : ndnboost::detail::lightweight_forward_adapter_result::template apply<
+            ndnboost::lightweight_forward_adapter<F,A0,A1> const () >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::lightweight_forward_adapter<F,A0,A1>()>
+        : ndnboost::detail::lightweight_forward_adapter_result::template apply<
+            ndnboost::lightweight_forward_adapter<F,A0,A1>() >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::lightweight_forward_adapter<F,A0,A1> const& ()>
+        : ndnboost::detail::lightweight_forward_adapter_result::template apply<
+            ndnboost::lightweight_forward_adapter<F,A0,A1> const () >
+    { };
+    template<class F, int A0, int A1>
+    struct result_of<ndnboost::lightweight_forward_adapter<F,A0,A1>& ()>
+        : ndnboost::detail::lightweight_forward_adapter_result::template apply<
+            ndnboost::lightweight_forward_adapter<F,A0,A1>() >
+    { };
+}
+
+#     define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_HPP_INCLUDED
+
+#   else // defined(BOOST_PP_IS_ITERATING)
+#     define N BOOST_PP_ITERATION() 
+
+        template< class Self, BOOST_PP_ENUM_PARAMS(N,typename T) >
+        struct lightweight_forward_adapter_result::apply<
+            Self (BOOST_PP_ENUM_PARAMS(N,T)) >
+            : ndnboost::result_of<
+                BOOST_DEDUCED_TYPENAME c<Self>::t (BOOST_PP_ENUM_BINARY_PARAMS(N,
+                    typename x<T,>::t BOOST_PP_INTERCEPT)) >
+        { };
+
+        template< class MD, class F, class FC >
+        struct lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),N>
+            : lightweight_forward_adapter_result
+        {
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename ndnboost::result_of< F(BOOST_PP_ENUM_BINARY_PARAMS(N,
+                T,const& BOOST_PP_INTERCEPT)) >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT));
+        };
+
+        template< class MD, class F, class FC, int MinArity >
+        struct lightweight_forward_adapter_impl<MD,F,FC,N,MinArity>
+            : lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>
+        {
+            using lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),
+                MinArity>::operator();
+
+#     define M(z,i,d) \
+          static_cast<typename d::template x<T##i>::t>(a##i)
+
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename lightweight_forward_adapter_result::template apply<
+                MD const (BOOST_PP_ENUM_BINARY_PARAMS(N,
+                    T,const& BOOST_PP_INTERCEPT)) >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
+            {
+                typedef lightweight_forward_adapter_result _;
+                return static_cast<MD const*>(this)->target_function()(
+                    BOOST_PP_ENUM(N,M,_));
+            }
+            template< BOOST_PP_ENUM_PARAMS(N,typename T) >
+            inline typename lightweight_forward_adapter_result::template apply<
+                MD (BOOST_PP_ENUM_BINARY_PARAMS(N,
+                    T,const& BOOST_PP_INTERCEPT)) >::type
+            operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
+            {
+                typedef lightweight_forward_adapter_result _;
+                return static_cast<MD*>(this)->target_function()(
+                    BOOST_PP_ENUM(N,M,_));
+            }
+#     undef M
+      };
+
+#     undef N
+#   endif // defined(BOOST_PP_IS_ITERATING)
+
+#endif // include guard
+
diff --git a/ndnboost/functional/overloaded_function.hpp b/ndnboost/functional/overloaded_function.hpp
new file mode 100644
index 0000000..d2a1369
--- /dev/null
+++ b/ndnboost/functional/overloaded_function.hpp
@@ -0,0 +1,311 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef DOXYGEN // Doxygen documentation only.
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_
+
+#       include <ndnboost/functional/overloaded_function/detail/base.hpp>
+#       include <ndnboost/functional/overloaded_function/detail/function_type.hpp>
+#       include <ndnboost/functional/overloaded_function/config.hpp>
+#       include <ndnboost/typeof/typeof.hpp>
+#       include <ndnboost/preprocessor/iteration/iterate.hpp>
+#       include <ndnboost/preprocessor/repetition/enum.hpp>
+#       include <ndnboost/preprocessor/repetition/repeat.hpp>
+#       include <ndnboost/preprocessor/control/expr_iif.hpp>
+#       include <ndnboost/preprocessor/control/expr_if.hpp>
+#       include <ndnboost/preprocessor/comparison/greater.hpp>
+#       include <ndnboost/preprocessor/comparison/less.hpp>
+#       include <ndnboost/preprocessor/cat.hpp>
+#       include <ndnboost/preprocessor/arithmetic/add.hpp>
+#       include <ndnboost/preprocessor/arithmetic/sub.hpp>
+#       include <ndnboost/preprocessor/tuple/eat.hpp>
+#       include <ndnboost/preprocessor/logical/and.hpp>
+#       include <ndnboost/preprocessor/logical/not.hpp>
+#       include <ndnboost/preprocessor/facilities/expand.hpp>
+
+#define BOOST_FUNCTIONAL_f_type(z, n, unused) \
+    BOOST_PP_CAT(F, n)
+
+#define BOOST_FUNCTIONAL_f_arg(z, n, unused) \
+    BOOST_PP_CAT(f, n)
+
+#define BOOST_FUNCTIONAL_f_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_f_type(z, n, ~) \
+
+#define BOOST_FUNCTIONAL_f_tparam_dflt(z, n, is_tspec) \
+    BOOST_FUNCTIONAL_f_tparam(z, n, ~) \
+    /* overload requires at least 2 functors so F0 and F1 not optional */ \
+    BOOST_PP_EXPR_IIF(BOOST_PP_AND(BOOST_PP_NOT(is_tspec), \
+            BOOST_PP_GREATER(n, 1)), \
+        = void \
+    )
+
+#define BOOST_FUNCTIONAL_f_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_f_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_f_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_type(z, n, unused) \
+    BOOST_PP_CAT(G, n)
+
+#define BOOST_FUNCTIONAL_g_arg(z, n, unused) \
+    BOOST_PP_CAT(g, n)
+
+#define BOOST_FUNCTIONAL_g_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_g_type(z, n, ~)
+
+#define BOOST_FUNCTIONAL_g_arg_decl(z, n, unused) \
+    BOOST_FUNCTIONAL_g_type(z, n, ~) /* no qualifier to deduce tparam */ \
+    BOOST_FUNCTIONAL_g_arg(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base(z, n, unused) \
+    ::ndnboost::overloaded_function_detail::base< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >
+
+#define BOOST_FUNCTIONAL_inherit(z, n, unused) \
+    public BOOST_FUNCTIONAL_base(z, n, ~)
+
+#define BOOST_FUNCTIONAL_base_init(z, n, unused) \
+    BOOST_FUNCTIONAL_base(z, n, ~)(BOOST_FUNCTIONAL_g_arg(z, n, ~))
+
+#define BOOST_FUNCTIONAL_using_operator_call(z, n, unused) \
+    using BOOST_FUNCTIONAL_base(z, n, ~)::operator();
+
+#define BOOST_FUNCTIONAL_function_type(z, n, unused) \
+    typename ::ndnboost::overloaded_function_detail::function_type< \
+        BOOST_FUNCTIONAL_f_type(z, n, ~) \
+    >::type
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+            /* at least 2 func to overload so start from 2 to MAX */ \
+            /* (cannot iterate [0, MAX-2) because error on Sun) */ \
+            (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+            "ndnboost/functional/overloaded_function.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over function arity.
+
+#undef BOOST_FUNCTIONAL_f_type
+#undef BOOST_FUNCTIONAL_f_arg
+#undef BOOST_FUNCTIONAL_f_tparam
+#undef BOOST_FUNCTIONAL_f_arg_decl
+#undef BOOST_FUNCTIONAL_f_tparam_dflt
+#undef BOOST_FUNCTIONAL_g_type
+#undef BOOST_FUNCTIONAL_g_arg
+#undef BOOST_FUNCTIONAL_g_tparam
+#undef BOOST_FUNCTIONAL_g_arg_decl
+#undef BOOST_FUNCTIONAL_base
+#undef BOOST_FUNCTIONAL_inherit
+#undef BOOST_FUNCTIONAL_base_init
+#undef BOOST_FUNCTIONAL_using_operator_call
+#undef BOOST_FUNCTIONAL_function_type
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_overloads \
+        /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \
+        /* (add 2 because iteration started from 2 to MAX) */ \
+        BOOST_PP_ADD(2, BOOST_PP_SUB( \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \
+                BOOST_PP_FRAME_ITERATION(1)))
+#   define BOOST_FUNCTIONAL_is_tspec \
+        /* if template specialization */ \
+        BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \
+                BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX)
+
+// For type-of emulation: This must be included at this pp iteration level.
+#   include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+namespace ndnboost {
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam_dflt,
+            BOOST_FUNCTIONAL_is_tspec)
+>
+class overloaded_function
+    // Template specialization.
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), <)
+    BOOST_PP_IIF(BOOST_FUNCTIONAL_is_tspec,
+        BOOST_PP_ENUM
+    ,
+        BOOST_PP_TUPLE_EAT(3)
+    )(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_type, ~)
+    BOOST_PP_EXPR_IIF(BOOST_PP_EXPAND(BOOST_FUNCTIONAL_is_tspec), >)
+    // Bases (overloads >= 2 so always at least 2 bases).
+    : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+            BOOST_FUNCTIONAL_inherit, ~)
+{
+public:
+    template<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_g_tparam, ~)
+    > /* implicit */ inline overloaded_function(
+            BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_g_arg_decl, ~))
+            // Overloads >= 2 so always at least 2 bases to initialize.
+            : BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                    BOOST_FUNCTIONAL_base_init, ~)
+    {}
+
+    BOOST_PP_REPEAT(BOOST_FUNCTIONAL_overloads, 
+            BOOST_FUNCTIONAL_using_operator_call, ~)
+};
+
+template<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_tparam, ~)
+>
+overloaded_function<
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_function_type, ~)
+> make_overloaded_function(
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg_decl, ~)
+) {
+    return overloaded_function<
+        BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads,
+                BOOST_FUNCTIONAL_function_type, ~)
+    >(BOOST_PP_ENUM(BOOST_FUNCTIONAL_overloads, BOOST_FUNCTIONAL_f_arg, ~));
+}
+
+} // namespace
+
+// For type-of emulation: Register overloaded function type (for _AUTO, etc).
+BOOST_TYPEOF_REGISTER_TEMPLATE(ndnboost::overloaded_function,
+    BOOST_FUNCTIONAL_overloads)
+
+#   undef BOOST_FUNCTIONAL_overloads
+#   undef BOOST_FUNCTIONAL_is_tspec
+#endif // iteration
+
+// DOCUMENTATION //
+
+#else // DOXYGEN
+
+/** @file
+@brief Overload distinct function pointers, function references, and
+monomorphic function objects into a single function object.
+*/
+
+namespace ndnboost {
+
+/**
+@brief Function object to overload functions with distinct signatures.
+
+This function object aggregates together calls to functions of all the
+specified function types <c>F1</c>, <c>F2</c>, etc which must have distinct
+function signatures from one another.
+
+@Params
+@Param{F<em>i</em>,
+Each function type must be specified using the following syntax (which is
+Boost.Function's preferred syntax):
+@code
+    result_type (argument1_type\, argumgnet2_type\, ...)
+@endcode
+}
+@EndParams
+
+In some cases, the @RefFunc{make_overloaded_function} function template can be
+useful to construct an overloaded function object without explicitly
+specifying the function types.
+
+At least two distinct function types must be specified (because there is
+nothing to overload between one or zero functions).
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+The maximum number of function parameters for each of the specified function
+types is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX}
+configuration macro.
+
+@See @RefSect{tutorial, Tutorial} section, @RefFunc{make_overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX},
+Boost.Function.
+*/
+template<typename F1, typename F2, ...>
+class overloaded_function {
+public:
+    /**
+    @brief Construct the overloaded function object.
+
+    Any function pointer, function reference, and monomorphic function object
+    that can be converted to a <c>ndnboost::function</c> function object can be
+    specified as parameter.
+
+    @Note Unfortunately, it is not possible to support polymorphic function
+    objects (as explained <a
+    href="http://lists.boost.org/Archives/boost/2012/03/191744.php">here</a>).
+    */
+    overloaded_function(const ndnboost::function<F1>&,
+            const ndnboost::function<F2>&, ...);
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 1st template parameter.
+
+    This will in turn invoke the call operator of the 1st function passed to
+    the constructor.
+    */
+    typename ndnboost::function_traits<F1>::result_type operator()(
+            typename ndnboost::function_traits<F1>::arg1_type,
+            typename ndnboost::function_traits<F1>::arg2_type,
+            ...) const;
+
+    /**
+    @brief Call operator matching the signature of the function type specified
+    as 2nd template parameter.
+
+    This will in turn invoke the call operator of the 2nd function passed to
+    the constructor.
+
+    @Note Similar call operators are present for all specified function types
+    <c>F1</c>, <c>F2</c>, etc (even if not exhaustively listed by this
+    documentation).
+    */
+    typename ndnboost::function_traits<F2>::result_type operator()(
+            typename ndnboost::function_traits<F2>::arg1_type,
+            typename ndnboost::function_traits<F2>::arg2_type,
+            ...) const;
+};
+
+/**
+@brief Make an overloaded function object without explicitly specifying the
+function types.
+
+This function template creates and returns an @RefClass{overloaded_function}
+object that overloads all the specified functions <c>f1</c>, <c>f2</c>, etc.
+
+The function types are internally determined from the template parameter types
+so they do not need to be explicitly specified.
+Therefore, this function template usually has a more concise syntax when
+compared with @RefClass{overloaded_function}.
+This is especially useful when the explicit type of the returned
+@RefClass{overloaded_function} object does not need to be known (e.g., when
+used with Boost.Typeof's <c>BOOST_AUTO</c>, C++11 <c>auto</c>, or when the
+overloaded function object is handled using a function template parameter, see
+the @RefSect{tutorial, Tutorial} section).
+
+The maximum number of functions to overload is given by the
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}
+configuration macro.
+
+@Note In this documentation, <c>__function_type__</c> is a placeholder for a
+symbol that is specific to the implementation of this library.
+
+@See @RefSect{tutorial, Tutorial} section, @RefClass{overloaded_function},
+@RefMacro{BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX}.
+*/
+template<typename F1, typename F2, ...>
+overloaded_function<
+    __function_type__<F1>, __function_type__<F2>, ...
+> make_overloaded_function(F1 f1, F2 f2, ...);
+
+} // namespace
+
+#endif // DOXYGEN
+
diff --git a/ndnboost/functional/overloaded_function/config.hpp b/ndnboost/functional/overloaded_function/config.hpp
new file mode 100644
index 0000000..33ff1b5
--- /dev/null
+++ b/ndnboost/functional/overloaded_function/config.hpp
@@ -0,0 +1,50 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_HPP_
+
+/** @file
+@brief Change the compile-time configuration of this library.
+*/
+
+/**
+@brief Specify the maximum number of arguments of the functions being
+overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When specified by the user, this macro must be a non-negative integer number.
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{ndnboost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX 5
+#endif
+
+/**
+@brief Specify the maximum number of functions that can be overloaded.
+
+If this macro is left undefined by the user, it has a default value of 5
+(increasing this number might increase compilation time).
+When defined by the user, this macro must be an integer number greater or
+equal than 2 (because at least two distinct functions need to be specified in
+order to define an overload).
+
+@See @RefSect{getting_started, Getting Started},
+@RefClass{ndnboost::overloaded_function}.
+*/
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
+#   define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX 5
+#endif
+#if BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX < 2
+#   error "maximum overload macro cannot be less than 2"
+#endif
+
+#endif // #include guard
+
diff --git a/ndnboost/functional/overloaded_function/detail/base.hpp b/ndnboost/functional/overloaded_function/detail/base.hpp
new file mode 100644
index 0000000..c4cef04
--- /dev/null
+++ b/ndnboost/functional/overloaded_function/detail/base.hpp
@@ -0,0 +1,86 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#if !BOOST_PP_IS_ITERATING
+#   ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+#       define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
+
+#       include <ndnboost/functional/overloaded_function/config.hpp>
+#       include <ndnboost/function.hpp>
+#       include <ndnboost/preprocessor/iteration/iterate.hpp>
+#       include <ndnboost/preprocessor/repetition/enum.hpp>
+#       include <ndnboost/preprocessor/cat.hpp>
+#       include <ndnboost/preprocessor/comma_if.hpp>
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_PP_CAT(A, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \
+    BOOST_PP_CAT(a, n)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \
+    typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
+    BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused)
+
+#define BOOST_FUNCTIONAL_DETAIL_f \
+    R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \
+            BOOST_FUNCTIONAL_DETAIL_arg_type, ~))
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace ndnboost { namespace overloaded_function_detail {
+
+template<typename F>
+class base {}; // Empty template cannot be used directly (only its spec).
+
+#       define BOOST_PP_ITERATION_PARAMS_1 \
+                (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \
+                "ndnboost/functional/overloaded_function/detail/base.hpp"))
+#       include BOOST_PP_ITERATE() // Iterate over funciton arity.
+
+} } // namespace
+
+#undef BOOST_FUNCTIONAL_DETAIL_arg_type
+#undef BOOST_FUNCTIONAL_DETAIL_arg_name
+#undef BOOST_FUNCTIONAL_DETAIL_arg_tparam
+#undef BOOST_FUNCTIONAL_DETAIL_arg
+#undef BOOST_FUNCTIONAL_DETAIL_f
+
+#   endif // #include guard
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+#   define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1)
+
+template<
+    typename R
+    BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity)
+    BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~)
+>
+class base< BOOST_FUNCTIONAL_DETAIL_f > {
+public:
+    /* implicit */ inline base(
+            // This requires specified type to be implicitly convertible to
+            // a ndnboost::function<> functor.
+            ndnboost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f)
+    {}
+
+    inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+            BOOST_FUNCTIONAL_DETAIL_arg, ~)) const {
+        return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
+                BOOST_FUNCTIONAL_DETAIL_arg_name, ~));
+    }
+
+private:
+    ndnboost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_;
+};
+
+#   undef BOOST_FUNCTIONAL_DETAIL_arity
+#endif // iteration
+
diff --git a/ndnboost/functional/overloaded_function/detail/function_type.hpp b/ndnboost/functional/overloaded_function/detail/function_type.hpp
new file mode 100644
index 0000000..7119f93
--- /dev/null
+++ b/ndnboost/functional/overloaded_function/detail/function_type.hpp
@@ -0,0 +1,85 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+#define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_FUNCTION_TYPE_HPP_
+
+#include <ndnboost/function_types/is_function.hpp>
+#include <ndnboost/function_types/is_function_pointer.hpp>
+#include <ndnboost/function_types/is_function_reference.hpp>
+#include <ndnboost/function_types/function_type.hpp>
+#include <ndnboost/function_types/parameter_types.hpp>
+#include <ndnboost/function_types/result_type.hpp>
+#include <ndnboost/type_traits/remove_pointer.hpp>
+#include <ndnboost/type_traits/remove_reference.hpp>
+#include <ndnboost/function.hpp>
+#include <ndnboost/mpl/if.hpp>
+#include <ndnboost/mpl/identity.hpp>
+#include <ndnboost/mpl/pop_front.hpp>
+#include <ndnboost/mpl/push_front.hpp>
+#include <ndnboost/typeof/typeof.hpp>
+
+// Do not use namespace ::detail because overloaded_function is already a class.
+namespace ndnboost { namespace overloaded_function_detail {
+
+// Requires: F is a monomorphic functor (i.e., has non-template `operator()`).
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+// It does not assume F typedef result_type, arg1_type, ... but needs typeof.
+template<typename F>
+class functor_type {
+    // NOTE: clang does not accept extra parenthesis `&(...)`.
+    typedef BOOST_TYPEOF_TPL(&F::operator()) call_ptr;
+public:
+    typedef
+        typename ndnboost::function_types::function_type<
+            typename ndnboost::mpl::push_front<
+                  typename ndnboost::mpl::pop_front< // Remove functor type (1st).
+                    typename ndnboost::function_types::parameter_types<
+                            call_ptr>::type
+                  >::type
+                , typename ndnboost::function_types::result_type<call_ptr>::type
+            >::type
+        >::type
+    type;
+};
+
+// NOTE: When using ndnboost::function in Boost.Typeof emulation mode, the user
+// has to register ndnboost::functionN instead of ndnboost::function in oder to
+// do TYPEOF(F::operator()). That is confusing, so ndnboost::function is handled
+// separately so it does not require any Boost.Typeof registration at all.
+template<typename F>
+struct functor_type< ndnboost::function<F> > {
+    typedef F type;
+};
+
+// Requires: F is a function type, pointer, reference, or monomorphic functor.
+// Returns: F's function type `result_type (arg1_type, arg2_type, ...)`.
+template<typename F>
+struct function_type {
+    typedef
+        typename ndnboost::mpl::if_<ndnboost::function_types::is_function<F>,
+            ndnboost::mpl::identity<F>
+        ,
+            typename ndnboost::mpl::if_<ndnboost::function_types::
+                    is_function_pointer<F>,
+                ndnboost::remove_pointer<F>
+            ,
+                typename ndnboost::mpl::if_<ndnboost::function_types::
+                        is_function_reference<F>,
+                    ndnboost::remove_reference<F>
+                , // Else, requires that F is a functor.
+                    functor_type<F>
+                >::type
+            >::type
+        >::type
+    ::type type;
+};
+
+} } // namespace
+
+#endif // #include guard
+
diff --git a/ndnboost/functional/value_factory.hpp b/ndnboost/functional/value_factory.hpp
new file mode 100644
index 0000000..c917519
--- /dev/null
+++ b/ndnboost/functional/value_factory.hpp
@@ -0,0 +1,70 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    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).
+==============================================================================*/
+
+#ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
+#   ifndef BOOST_PP_IS_ITERATING
+
+#     include <ndnboost/preprocessor/iteration/iterate.hpp>
+#     include <ndnboost/preprocessor/repetition/enum_params.hpp>
+#     include <ndnboost/preprocessor/repetition/enum_binary_params.hpp>
+
+#     include <new>
+#     include <ndnboost/pointee.hpp>
+#     include <ndnboost/none_t.hpp>
+#     include <ndnboost/get_pointer.hpp>
+#     include <ndnboost/non_type.hpp>
+#     include <ndnboost/type_traits/remove_cv.hpp>
+
+#     ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
+#       define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 10
+#     elif BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY < 3
+#       undef  BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
+#       define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 3
+#     endif
+
+namespace ndnboost
+{
+    template< typename T >
+    class value_factory;
+
+    //----- ---- --- -- - -  -   -
+
+    template< typename T >
+    class value_factory
+    {
+      public:
+        typedef T result_type;
+
+        value_factory()
+        { }
+
+#     define BOOST_PP_FILENAME_1 <ndnboost/functional/value_factory.hpp>
+#     define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY)
+#     include BOOST_PP_ITERATE()
+    };
+
+    template< typename T > class value_factory<T&>;
+    // forbidden, would create a dangling reference
+}
+#     define BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
+#   else // defined(BOOST_PP_IS_ITERATING)
+
+#     define N BOOST_PP_ITERATION()
+#     if N > 0
+    template< BOOST_PP_ENUM_PARAMS(N, typename T) >
+#     endif
+    inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
+    {
+        return result_type(BOOST_PP_ENUM_PARAMS(N,a));
+    }
+#     undef N
+
+#   endif // defined(BOOST_PP_IS_ITERATING)
+
+#endif // include guard
+
