diff --git a/ndnboost/algorithm/string/compare.hpp b/ndnboost/algorithm/string/compare.hpp
new file mode 100644
index 0000000..e963120
--- /dev/null
+++ b/ndnboost/algorithm/string/compare.hpp
@@ -0,0 +1,199 @@
+//  Boost string_algo library compare.hpp header file  -------------------------//
+
+//  Copyright Pavol Droba 2002-2006.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_COMPARE_HPP
+#define BOOST_STRING_COMPARE_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <locale>
+
+/*! \file
+    Defines element comparison predicates. Many algorithms in this library can
+    take an additional argument with a predicate used to compare elements.
+    This makes it possible, for instance, to have case insensitive versions
+    of the algorithms.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+        //  is_equal functor  -----------------------------------------------//
+
+        //! is_equal functor
+        /*!
+            Standard STL equal_to only handle comparison between arguments
+            of the same type. This is a less restrictive version which wraps operator ==.
+        */
+        struct is_equal
+        {
+            //! Function operator
+            /*!
+                Compare two operands for equality
+            */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                return Arg1==Arg2;
+            }
+        };
+
+        //! case insensitive version of is_equal
+        /*!
+            Case insensitive comparison predicate. Comparison is done using
+            specified locales.
+        */
+        struct is_iequal
+        {
+            //! Constructor
+            /*!
+                \param Loc locales used for comparison
+            */
+            is_iequal( const std::locale& Loc=std::locale() ) :
+                m_Loc( Loc ) {}
+
+            //! Function operator
+            /*!
+                Compare two operands. Case is ignored.
+            */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
+                    return std::toupper(Arg1)==std::toupper(Arg2);
+                #else
+                    return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc);
+                #endif
+            }
+
+        private:
+            std::locale m_Loc;
+        };
+
+        //  is_less functor  -----------------------------------------------//
+
+        //! is_less functor
+        /*!
+            Convenient version of standard std::less. Operation is templated, therefore it is 
+            not required to specify the exact types upon the construction
+         */
+        struct is_less
+        {
+            //! Functor operation
+            /*!
+                Compare two operands using > operator
+             */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                return Arg1<Arg2;
+            }
+        };
+
+
+        //! case insensitive version of is_less
+        /*!
+            Case insensitive comparison predicate. Comparison is done using
+            specified locales.
+        */
+        struct is_iless
+        {
+            //! Constructor
+            /*!
+                \param Loc locales used for comparison
+            */
+            is_iless( const std::locale& Loc=std::locale() ) :
+                m_Loc( Loc ) {}
+
+            //! Function operator
+            /*!
+                Compare two operands. Case is ignored.
+            */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
+                    return std::toupper(Arg1)<std::toupper(Arg2);
+                #else
+                    return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc);
+                #endif
+            }
+
+        private:
+            std::locale m_Loc;
+        };
+
+        //  is_not_greater functor  -----------------------------------------------//
+
+        //! is_not_greater functor
+        /*!
+            Convenient version of standard std::not_greater_to. Operation is templated, therefore it is 
+            not required to specify the exact types upon the construction
+         */
+        struct is_not_greater
+        {
+            //! Functor operation
+            /*!
+                Compare two operands using > operator
+             */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                return Arg1<=Arg2;
+            }
+        };
+
+
+        //! case insensitive version of is_not_greater
+        /*!
+            Case insensitive comparison predicate. Comparison is done using
+            specified locales.
+        */
+        struct is_not_igreater
+        {
+            //! Constructor
+            /*!
+                \param Loc locales used for comparison
+            */
+            is_not_igreater( const std::locale& Loc=std::locale() ) :
+                m_Loc( Loc ) {}
+
+            //! Function operator
+            /*!
+                Compare two operands. Case is ignored.
+            */
+            template< typename T1, typename T2 >
+                bool operator()( const T1& Arg1, const T2& Arg2 ) const
+            {
+                #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
+                    return std::toupper(Arg1)<=std::toupper(Arg2);
+                #else
+                    return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc);
+                #endif
+            }
+
+        private:
+            std::locale m_Loc;
+        };
+
+
+    } // namespace algorithm
+
+    // pull names to the boost namespace
+    using algorithm::is_equal;
+    using algorithm::is_iequal;
+    using algorithm::is_less;
+    using algorithm::is_iless;
+    using algorithm::is_not_greater;
+    using algorithm::is_not_igreater;
+
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_COMPARE_HPP
diff --git a/ndnboost/algorithm/string/concept.hpp b/ndnboost/algorithm/string/concept.hpp
new file mode 100644
index 0000000..31faa80
--- /dev/null
+++ b/ndnboost/algorithm/string/concept.hpp
@@ -0,0 +1,83 @@
+//  Boost string_algo library concept.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_CONCEPT_HPP
+#define BOOST_STRING_CONCEPT_HPP
+
+#include <ndnboost/concept_check.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+
+/*! \file 
+    Defines concepts used in string_algo library
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+        //! Finder concept
+        /*!
+            Defines the Finder concept. Finder is a functor which selects
+            an arbitrary part of a string. Search is performed on
+            the range specified by starting and ending iterators.
+
+            Result of the find operation must be convertible to iterator_range.
+        */
+        template<typename FinderT, typename IteratorT>
+        struct FinderConcept
+        {
+        private:
+            typedef iterator_range<IteratorT> range;
+        public:
+            void constraints()
+            {
+                // Operation
+                r=(*pF)(i,i);
+            }
+        private:
+            range r;
+            IteratorT i;
+            FinderT* pF;    
+        }; // Finder_concept
+
+        
+        //! Formatter concept
+        /*!
+            Defines the Formatter concept. Formatter is a functor, which
+            takes a result from a finder operation and transforms it
+            in a specific way.
+
+            Result must be a container supported by container_traits, 
+            or a reference to it.
+        */
+        template<typename FormatterT, typename FinderT, typename IteratorT>
+        struct FormatterConcept
+        {
+        public:
+            void constraints()
+            {
+                // Operation
+                ::ndnboost::begin((*pFo)( (*pF)(i,i) ));
+                ::ndnboost::end((*pFo)( (*pF)(i,i) ));
+            }
+        private:
+            IteratorT i;
+            FinderT* pF;
+            FormatterT *pFo;
+        }; // FormatterConcept;
+
+    } // namespace algorithm
+} // namespace ndnboost
+
+
+
+
+#endif  // BOOST_STRING_CONCEPT_HPP
diff --git a/ndnboost/algorithm/string/config.hpp b/ndnboost/algorithm/string/config.hpp
new file mode 100644
index 0000000..4ed3d05
--- /dev/null
+++ b/ndnboost/algorithm/string/config.hpp
@@ -0,0 +1,28 @@
+//  Boost string_algo library config.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_CONFIG_HPP
+#define BOOST_STRING_CONFIG_HPP
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/detail/workaround.hpp>
+
+#ifdef BOOST_STRING_DEDUCED_TYPENAME
+#   error "macro already defined!"
+#endif
+
+#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
+
+// Metrowerks workaround
+#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x
+#pragma parse_func_templ off
+#endif
+
+#endif  // BOOST_STRING_CONFIG_HPP
diff --git a/ndnboost/algorithm/string/constants.hpp b/ndnboost/algorithm/string/constants.hpp
new file mode 100644
index 0000000..232d0d8
--- /dev/null
+++ b/ndnboost/algorithm/string/constants.hpp
@@ -0,0 +1,36 @@
+//  Boost string_algo library constants.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_CONSTANTS_HPP
+#define BOOST_STRING_CONSTANTS_HPP
+
+namespace ndnboost {
+    namespace algorithm {
+
+    //! Token compression mode 
+    /*!
+        Specifies token compression mode for the token_finder.
+    */
+    enum token_compress_mode_type
+    {
+        token_compress_on,    //!< Compress adjacent tokens
+        token_compress_off  //!< Do not compress adjacent tokens
+    };
+    
+    } // namespace algorithm
+
+    // pull the names to the boost namespace
+    using algorithm::token_compress_on;
+    using algorithm::token_compress_off;
+
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_CONSTANTS_HPP
+
diff --git a/ndnboost/algorithm/string/detail/find_format.hpp b/ndnboost/algorithm/string/detail/find_format.hpp
new file mode 100644
index 0000000..395beaf
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/find_format.hpp
@@ -0,0 +1,204 @@
+//  Boost string_algo library find_format.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+// 
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FIND_FORMAT_DETAIL_HPP
+#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+#include <ndnboost/range/iterator.hpp>
+#include <ndnboost/algorithm/string/detail/find_format_store.hpp>
+#include <ndnboost/algorithm/string/detail/replace_storage.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+// find_format_copy (iterator variant) implementation -------------------------------//
+
+           template< 
+                typename OutputIteratorT,
+                typename InputT,
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline OutputIteratorT find_format_copy_impl2(
+                OutputIteratorT Output,
+                const InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult,
+                const FormatResultT& FormatResult )
+            {       
+                typedef find_format_store<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<InputT>::type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+
+                if ( !M )
+                {
+                    // Match not found - return original sequence
+                    Output = std::copy( ::ndnboost::begin(Input), ::ndnboost::end(Input), Output );
+                    return Output;
+                }
+
+                // Copy the beginning of the sequence
+                Output = std::copy( ::ndnboost::begin(Input), ::ndnboost::begin(M), Output );
+                // Format find result
+                // Copy formatted result
+                Output = std::copy( ::ndnboost::begin(M.format_result()), ::ndnboost::end(M.format_result()), Output );
+                // Copy the rest of the sequence
+                Output = std::copy( M.end(), ::ndnboost::end(Input), Output );
+
+                return Output;
+            }
+
+            template< 
+                typename OutputIteratorT,
+                typename InputT,
+                typename FormatterT,
+                typename FindResultT >
+            inline OutputIteratorT find_format_copy_impl(
+                OutputIteratorT Output,
+                const InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult )
+            {   
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    return ::ndnboost::algorithm::detail::find_format_copy_impl2( 
+                        Output,
+                        Input,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                } else {
+                    return std::copy( ::ndnboost::begin(Input), ::ndnboost::end(Input), Output );
+                }
+            }
+
+ 
+// find_format_copy implementation --------------------------------------------------//
+
+           template< 
+                typename InputT, 
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline InputT find_format_copy_impl2(
+                const InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult,
+                const FormatResultT& FormatResult)
+            {
+                typedef find_format_store<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<InputT>::type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+
+                if ( !M )
+                {
+                    // Match not found - return original sequence
+                    return InputT( Input );
+                }
+
+                InputT Output;
+                // Copy the beginning of the sequence
+                ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), ::ndnboost::begin(Input), M.begin() );
+                // Copy formatted result
+                ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), M.format_result() );
+                // Copy the rest of the sequence
+                ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), M.end(), ::ndnboost::end(Input) );
+
+                return Output;
+            }
+
+            template< 
+                typename InputT, 
+                typename FormatterT,
+                typename FindResultT >
+            inline InputT find_format_copy_impl(
+                const InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult)
+            {
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    return ::ndnboost::algorithm::detail::find_format_copy_impl2(
+                        Input,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                } else {
+                    return Input;
+                }
+            }
+
+ // replace implementation ----------------------------------------------------//
+        
+            template<
+                typename InputT,
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline void find_format_impl2( 
+                InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult,
+                const FormatResultT& FormatResult)
+            {
+                typedef find_format_store<
+                    BOOST_STRING_TYPENAME 
+                        range_iterator<InputT>::type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+
+                if ( !M )
+                {
+                    // Search not found - return original sequence
+                    return;
+                }
+
+                // Replace match
+                ::ndnboost::algorithm::detail::replace( Input, M.begin(), M.end(), M.format_result() );
+            }
+
+            template<
+                typename InputT,
+                typename FormatterT,
+                typename FindResultT >
+            inline void find_format_impl( 
+                InputT& Input,
+                FormatterT Formatter,
+                const FindResultT& FindResult)
+            {
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    ::ndnboost::algorithm::detail::find_format_impl2(
+                        Input,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                }
+            }
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_FIND_FORMAT_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/find_format_all.hpp b/ndnboost/algorithm/string/detail/find_format_all.hpp
new file mode 100644
index 0000000..ee0312a
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/find_format_all.hpp
@@ -0,0 +1,273 @@
+//  Boost string_algo library find_format_all.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
+#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+#include <ndnboost/range/value_type.hpp>
+#include <ndnboost/algorithm/string/detail/find_format_store.hpp>
+#include <ndnboost/algorithm/string/detail/replace_storage.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+// find_format_all_copy (iterator variant) implementation ---------------------------//
+
+           template< 
+                typename OutputIteratorT,
+                typename InputT,
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline OutputIteratorT find_format_all_copy_impl2(
+                OutputIteratorT Output,
+                const InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                const FindResultT& FindResult,
+                const FormatResultT& FormatResult )
+            {       
+                typedef BOOST_STRING_TYPENAME 
+                    range_const_iterator<InputT>::type input_iterator_type; 
+
+                typedef find_format_store<
+                        input_iterator_type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+
+                // Initialize last match
+                input_iterator_type LastMatch=::ndnboost::begin(Input);
+
+                // Iterate through all matches
+                while( M )
+                {
+                    // Copy the beginning of the sequence
+                    Output = std::copy( LastMatch, M.begin(), Output );
+                    // Copy formatted result
+                    Output = std::copy( ::ndnboost::begin(M.format_result()), ::ndnboost::end(M.format_result()), Output );
+
+                    // Proceed to the next match
+                    LastMatch=M.end();
+                    M=Finder( LastMatch, ::ndnboost::end(Input) );
+                }
+
+                // Copy the rest of the sequence
+                Output = std::copy( LastMatch, ::ndnboost::end(Input), Output );
+
+                return Output;
+            }
+
+            template< 
+                typename OutputIteratorT,
+                typename InputT,
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT >
+            inline OutputIteratorT find_format_all_copy_impl(
+                OutputIteratorT Output,
+                const InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                const FindResultT& FindResult )
+            {   
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    return ::ndnboost::algorithm::detail::find_format_all_copy_impl2( 
+                        Output,
+                        Input,
+                        Finder,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                } else {
+                    return std::copy( ::ndnboost::begin(Input), ::ndnboost::end(Input), Output );
+                }
+            }
+
+ // find_format_all_copy implementation ----------------------------------------------//
+
+           template< 
+                typename InputT, 
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline InputT find_format_all_copy_impl2(
+                const InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                const FindResultT& FindResult,
+                const FormatResultT& FormatResult)
+            {
+                typedef BOOST_STRING_TYPENAME 
+                    range_const_iterator<InputT>::type input_iterator_type; 
+
+                typedef find_format_store<
+                        input_iterator_type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+
+                // Initialize last match
+                input_iterator_type LastMatch=::ndnboost::begin(Input);
+
+                // Output temporary
+                InputT Output;
+
+                // Iterate through all matches
+                while( M )
+                {
+                    // Copy the beginning of the sequence
+                    ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), LastMatch, M.begin() );
+                    // Copy formatted result
+                    ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), M.format_result() );
+
+                    // Proceed to the next match
+                    LastMatch=M.end();
+                    M=Finder( LastMatch, ::ndnboost::end(Input) );
+                }
+
+                // Copy the rest of the sequence
+                ::ndnboost::algorithm::detail::insert( Output, ::ndnboost::end(Output), LastMatch, ::ndnboost::end(Input) );
+
+                return Output;
+            }
+
+            template< 
+                typename InputT, 
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT >
+            inline InputT find_format_all_copy_impl(
+                const InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                const FindResultT& FindResult)
+            {
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    return ::ndnboost::algorithm::detail::find_format_all_copy_impl2(
+                        Input,
+                        Finder,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                } else {
+                    return Input;
+                }
+            }
+
+ // find_format_all implementation ------------------------------------------------//
+        
+            template<
+                typename InputT,
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT,
+                typename FormatResultT >
+            inline void find_format_all_impl2( 
+                InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                FindResultT FindResult,
+                FormatResultT FormatResult)
+            {
+                typedef BOOST_STRING_TYPENAME 
+                    range_iterator<InputT>::type input_iterator_type; 
+                typedef find_format_store<
+                        input_iterator_type, 
+                        FormatterT,
+                        FormatResultT > store_type;
+
+                // Create store for the find result
+                store_type M( FindResult, FormatResult, Formatter );
+          
+                // Instantiate replacement storage
+                std::deque<
+                    BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
+
+                // Initialize replacement iterators
+                input_iterator_type InsertIt=::ndnboost::begin(Input);
+                input_iterator_type SearchIt=::ndnboost::begin(Input);
+                
+                while( M )
+                {
+                    // process the segment
+                    InsertIt=process_segment( 
+                        Storage,
+                        Input,
+                        InsertIt,
+                        SearchIt,
+                        M.begin() );
+                    
+                    // Adjust search iterator
+                    SearchIt=M.end();
+
+                    // Copy formatted replace to the storage
+                    ::ndnboost::algorithm::detail::copy_to_storage( Storage, M.format_result() );
+
+                    // Find range for a next match
+                    M=Finder( SearchIt, ::ndnboost::end(Input) );
+                }
+
+                // process the last segment
+                InsertIt=::ndnboost::algorithm::detail::process_segment( 
+                    Storage,
+                    Input,
+                    InsertIt,
+                    SearchIt,
+                    ::ndnboost::end(Input) );
+                
+                if ( Storage.empty() )
+                {
+                    // Truncate input
+                    ::ndnboost::algorithm::detail::erase( Input, InsertIt, ::ndnboost::end(Input) );
+                }
+                else
+                {
+                    // Copy remaining data to the end of input
+                    ::ndnboost::algorithm::detail::insert( Input, ::ndnboost::end(Input), Storage.begin(), Storage.end() );
+                }
+            }
+
+            template<
+                typename InputT,
+                typename FinderT,
+                typename FormatterT,
+                typename FindResultT >
+            inline void find_format_all_impl( 
+                InputT& Input,
+                FinderT Finder,
+                FormatterT Formatter,
+                FindResultT FindResult)
+            {
+                if( ::ndnboost::algorithm::detail::check_find_result(Input, FindResult) ) {
+                    ::ndnboost::algorithm::detail::find_format_all_impl2(
+                        Input,
+                        Finder,
+                        Formatter,
+                        FindResult,
+                        Formatter(FindResult) );
+                }
+            }
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/find_format_store.hpp b/ndnboost/algorithm/string/detail/find_format_store.hpp
new file mode 100644
index 0000000..d0d38bf
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/find_format_store.hpp
@@ -0,0 +1,89 @@
+//  Boost string_algo library find_format_store.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
+#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+//  temporary format and find result storage --------------------------------//
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+            template< 
+                typename ForwardIteratorT,
+                typename FormatterT,
+                typename FormatResultT >
+            class find_format_store : 
+                public iterator_range<ForwardIteratorT>
+            {
+            public:
+                // typedefs
+                typedef iterator_range<ForwardIteratorT> base_type;
+                typedef FormatterT  formatter_type;
+                typedef FormatResultT format_result_type;
+                
+            public:
+                // Construction
+                find_format_store( 
+                        const base_type& FindResult,
+                        const format_result_type& FormatResult,
+                        const formatter_type& Formatter ) :
+                    base_type(FindResult),
+                    m_FormatResult(FormatResult),
+                    m_Formatter(Formatter) {}
+
+                // Assignment
+                template< typename FindResultT >
+                find_format_store& operator=( FindResultT FindResult )
+                {
+                    iterator_range<ForwardIteratorT>::operator=(FindResult);
+                    if( !this->empty() ) {
+                        m_FormatResult=m_Formatter(FindResult);
+                    }
+                    
+                    return *this;
+                }
+
+                // Retrieve format result
+                const format_result_type& format_result()
+                {   
+                    return m_FormatResult;
+                }
+
+            private:
+                format_result_type m_FormatResult;
+                const formatter_type& m_Formatter;
+            };
+
+            template<typename InputT, typename FindResultT>
+            bool check_find_result(InputT&, FindResultT& FindResult)
+            {
+                typedef BOOST_STRING_TYPENAME 
+                    range_const_iterator<InputT>::type input_iterator_type; 
+                iterator_range<input_iterator_type> ResultRange(FindResult);
+                return !ResultRange.empty();
+            }
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/finder.hpp b/ndnboost/algorithm/string/detail/finder.hpp
new file mode 100644
index 0000000..330c7a5
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/finder.hpp
@@ -0,0 +1,646 @@
+//  Boost string_algo library finder.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2006.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FINDER_DETAIL_HPP
+#define BOOST_STRING_FINDER_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <ndnboost/algorithm/string/constants.hpp>
+#include <ndnboost/detail/iterator.hpp>
+
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+#include <ndnboost/range/empty.hpp>
+#include <ndnboost/range/as_literal.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+
+//  find first functor -----------------------------------------------//
+
+            // find a subsequence in the sequence ( functor )
+            /*
+                Returns a pair <begin,end> marking the subsequence in the sequence.
+                If the find fails, functor returns <End,End>
+            */
+            template<typename SearchIteratorT,typename PredicateT>
+            struct first_finderF
+            {
+                typedef SearchIteratorT search_iterator_type;
+
+                // Construction
+                template< typename SearchT >
+                first_finderF( const SearchT& Search, PredicateT Comp ) :
+                    m_Search(::ndnboost::begin(Search), ::ndnboost::end(Search)), m_Comp(Comp) {}
+                first_finderF(
+                        search_iterator_type SearchBegin,
+                        search_iterator_type SearchEnd,
+                        PredicateT Comp ) :
+                    m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    typedef iterator_range<ForwardIteratorT> result_type;
+                    typedef ForwardIteratorT input_iterator_type;
+
+                    // Outer loop
+                    for(input_iterator_type OuterIt=Begin;
+                        OuterIt!=End;
+                        ++OuterIt)
+                    {
+                        // Sanity check
+                        if( ndnboost::empty(m_Search) )
+                            return result_type( End, End );
+
+                        input_iterator_type InnerIt=OuterIt;
+                        search_iterator_type SubstrIt=m_Search.begin();
+                        for(;
+                            InnerIt!=End && SubstrIt!=m_Search.end();
+                            ++InnerIt,++SubstrIt)
+                        {
+                            if( !( m_Comp(*InnerIt,*SubstrIt) ) )
+                                break;
+                        }
+
+                        // Substring matching succeeded
+                        if ( SubstrIt==m_Search.end() )
+                            return result_type( OuterIt, InnerIt );
+                    }
+
+                    return result_type( End, End );
+                }
+
+            private:
+                iterator_range<search_iterator_type> m_Search;
+                PredicateT m_Comp;
+            };
+
+//  find last functor -----------------------------------------------//
+
+            // find the last match a subsequence in the sequence ( functor )
+            /*
+                Returns a pair <begin,end> marking the subsequence in the sequence.
+                If the find fails, returns <End,End>
+            */
+            template<typename SearchIteratorT, typename PredicateT>
+            struct last_finderF
+            {
+                typedef SearchIteratorT search_iterator_type;
+                typedef first_finderF<
+                    search_iterator_type,
+                    PredicateT> first_finder_type;
+
+                // Construction
+                template< typename SearchT >
+                last_finderF( const SearchT& Search, PredicateT Comp ) :
+                    m_Search(::ndnboost::begin(Search), ::ndnboost::end(Search)), m_Comp(Comp) {}
+                last_finderF(
+                        search_iterator_type SearchBegin,
+                        search_iterator_type SearchEnd,
+                        PredicateT Comp ) :
+                    m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    typedef iterator_range<ForwardIteratorT> result_type;
+
+                    if( ndnboost::empty(m_Search) )
+                        return result_type( End, End );
+
+                    typedef BOOST_STRING_TYPENAME ndnboost::detail::
+                        iterator_traits<ForwardIteratorT>::iterator_category category;
+
+                    return findit( Begin, End, category() );
+                }
+
+            private:
+                // forward iterator
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                findit(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End,
+                    std::forward_iterator_tag ) const
+                {
+                    typedef ForwardIteratorT input_iterator_type;
+                    typedef iterator_range<ForwardIteratorT> result_type;
+
+                    first_finder_type first_finder(
+                        m_Search.begin(), m_Search.end(), m_Comp );
+
+                    result_type M=first_finder( Begin, End );
+                    result_type Last=M;
+
+                    while( M )
+                    {
+                        Last=M;
+                        M=first_finder( ::ndnboost::end(M), End );
+                    }
+
+                    return Last;
+                }
+
+                // bidirectional iterator
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                findit(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End,
+                    std::bidirectional_iterator_tag ) const
+                {
+                    typedef iterator_range<ForwardIteratorT> result_type;
+                    typedef ForwardIteratorT input_iterator_type;
+
+                    // Outer loop
+                    for(input_iterator_type OuterIt=End;
+                        OuterIt!=Begin; )
+                    {
+                        input_iterator_type OuterIt2=--OuterIt;
+
+                        input_iterator_type InnerIt=OuterIt2;
+                        search_iterator_type SubstrIt=m_Search.begin();
+                        for(;
+                            InnerIt!=End && SubstrIt!=m_Search.end();
+                            ++InnerIt,++SubstrIt)
+                        {
+                            if( !( m_Comp(*InnerIt,*SubstrIt) ) )
+                                break;
+                        }
+
+                        // Substring matching succeeded
+                        if( SubstrIt==m_Search.end() )
+                            return result_type( OuterIt2, InnerIt );
+                    }
+
+                    return result_type( End, End );
+                }
+
+            private:
+                iterator_range<search_iterator_type> m_Search;
+                PredicateT m_Comp;
+            };
+
+//  find n-th functor -----------------------------------------------//
+
+            // find the n-th match of a subsequence in the sequence ( functor )
+            /*
+                Returns a pair <begin,end> marking the subsequence in the sequence.
+                If the find fails, returns <End,End>
+            */
+            template<typename SearchIteratorT, typename PredicateT>
+            struct nth_finderF
+            {
+                typedef SearchIteratorT search_iterator_type;
+                typedef first_finderF<
+                    search_iterator_type,
+                    PredicateT> first_finder_type;
+                typedef last_finderF<
+                    search_iterator_type,
+                    PredicateT> last_finder_type;
+
+                // Construction
+                template< typename SearchT >
+                nth_finderF(
+                        const SearchT& Search,
+                        int Nth,
+                        PredicateT Comp) :
+                    m_Search(::ndnboost::begin(Search), ::ndnboost::end(Search)),
+                    m_Nth(Nth),
+                    m_Comp(Comp) {}
+                nth_finderF(
+                        search_iterator_type SearchBegin,
+                        search_iterator_type SearchEnd,
+                        int Nth,
+                        PredicateT Comp) :
+                    m_Search(SearchBegin, SearchEnd),
+                    m_Nth(Nth),
+                    m_Comp(Comp) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    if(m_Nth>=0)
+                    {
+                        return find_forward(Begin, End, m_Nth);
+                    }
+                    else
+                    {
+                        return find_backward(Begin, End, -m_Nth);
+                    }
+
+                }
+
+            private:
+                // Implementation helpers
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                find_forward(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End,
+                    unsigned int N) const
+                {
+                    typedef ForwardIteratorT input_iterator_type;
+                    typedef iterator_range<ForwardIteratorT> result_type;
+
+                    // Sanity check
+                    if( ndnboost::empty(m_Search) )
+                        return result_type( End, End );
+
+                    // Instantiate find functor
+                    first_finder_type first_finder(
+                        m_Search.begin(), m_Search.end(), m_Comp );
+
+                    result_type M( Begin, Begin );
+
+                    for( unsigned int n=0; n<=N; ++n )
+                    {
+                        // find next match
+                        M=first_finder( ::ndnboost::end(M), End );
+
+                        if ( !M )
+                        {
+                            // Subsequence not found, return
+                            return M;
+                        }
+                    }
+
+                    return M;
+                }
+
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                find_backward(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End,
+                    unsigned int N) const
+                {
+                    typedef ForwardIteratorT input_iterator_type;
+                    typedef iterator_range<ForwardIteratorT> result_type;
+
+                    // Sanity check
+                    if( ndnboost::empty(m_Search) )
+                        return result_type( End, End );
+
+                    // Instantiate find functor
+                    last_finder_type last_finder(
+                        m_Search.begin(), m_Search.end(), m_Comp );
+
+                    result_type M( End, End );
+
+                    for( unsigned int n=1; n<=N; ++n )
+                    {
+                        // find next match
+                        M=last_finder( Begin, ::ndnboost::begin(M) );
+
+                        if ( !M )
+                        {
+                            // Subsequence not found, return
+                            return M;
+                        }
+                    }
+
+                    return M;
+                }
+
+
+            private:
+                iterator_range<search_iterator_type> m_Search;
+                int m_Nth;
+                PredicateT m_Comp;
+            };
+
+//  find head/tail implementation helpers ---------------------------//
+
+            template<typename ForwardIteratorT>
+                iterator_range<ForwardIteratorT>
+            find_head_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N,
+                std::forward_iterator_tag )
+            {
+                typedef ForwardIteratorT input_iterator_type;
+                typedef iterator_range<ForwardIteratorT> result_type;
+
+                input_iterator_type It=Begin;
+                for(
+                    unsigned int Index=0;
+                    Index<N && It!=End; ++Index,++It ) {};
+
+                return result_type( Begin, It );
+            }
+
+            template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+            find_head_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N,
+                std::random_access_iterator_tag )
+            {
+                typedef ForwardIteratorT input_iterator_type;
+                typedef iterator_range<ForwardIteratorT> result_type;
+
+                if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
+                    return result_type( Begin, End );
+
+                return result_type(Begin,Begin+N);
+            }
+
+            // Find head implementation
+            template<typename ForwardIteratorT>
+                iterator_range<ForwardIteratorT>
+            find_head_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N )
+            {
+                typedef BOOST_STRING_TYPENAME ndnboost::detail::
+                    iterator_traits<ForwardIteratorT>::iterator_category category;
+
+                return ::ndnboost::algorithm::detail::find_head_impl( Begin, End, N, category() );
+            }
+
+            template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+            find_tail_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N,
+                std::forward_iterator_tag )
+            {
+                typedef ForwardIteratorT input_iterator_type;
+                typedef iterator_range<ForwardIteratorT> result_type;
+
+                unsigned int Index=0;
+                input_iterator_type It=Begin;
+                input_iterator_type It2=Begin;
+
+                // Advance It2 by N increments
+                for( Index=0; Index<N && It2!=End; ++Index,++It2 ) {};
+
+                // Advance It, It2 to the end
+                for(; It2!=End; ++It,++It2 ) {};
+
+                return result_type( It, It2 );
+            }
+
+            template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+            find_tail_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N,
+                std::bidirectional_iterator_tag )
+            {
+                typedef ForwardIteratorT input_iterator_type;
+                typedef iterator_range<ForwardIteratorT> result_type;
+
+                input_iterator_type It=End;
+                for(
+                    unsigned int Index=0;
+                    Index<N && It!=Begin; ++Index,--It ) {};
+
+                return result_type( It, End );
+            }
+
+            template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+            find_tail_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N,
+                std::random_access_iterator_tag )
+            {
+                typedef ForwardIteratorT input_iterator_type;
+                typedef iterator_range<ForwardIteratorT> result_type;
+
+                if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
+                    return result_type( Begin, End );
+
+                return result_type( End-N, End );
+            }
+
+                        // Operation
+            template< typename ForwardIteratorT >
+            iterator_range<ForwardIteratorT>
+            find_tail_impl(
+                ForwardIteratorT Begin,
+                ForwardIteratorT End,
+                unsigned int N )
+            {
+                typedef BOOST_STRING_TYPENAME ndnboost::detail::
+                    iterator_traits<ForwardIteratorT>::iterator_category category;
+
+                return ::ndnboost::algorithm::detail::find_tail_impl( Begin, End, N, category() );
+            }
+
+
+
+//  find head functor -----------------------------------------------//
+
+
+            // find a head in the sequence ( functor )
+            /*
+                This functor find a head of the specified range. For
+                a specified N, the head is a subsequence of N starting
+                elements of the range.
+            */
+            struct head_finderF
+            {
+                // Construction
+                head_finderF( int N ) : m_N(N) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    if(m_N>=0)
+                    {
+                        return ::ndnboost::algorithm::detail::find_head_impl( Begin, End, m_N );
+                    }
+                    else
+                    {
+                        iterator_range<ForwardIteratorT> Res=
+                            ::ndnboost::algorithm::detail::find_tail_impl( Begin, End, -m_N );
+
+                        return ::ndnboost::make_iterator_range(Begin, Res.begin());
+                    }
+                }
+
+            private:
+                int m_N;
+            };
+
+//  find tail functor -----------------------------------------------//
+
+
+            // find a tail in the sequence ( functor )
+            /*
+                This functor find a tail of the specified range. For
+                a specified N, the head is a subsequence of N starting
+                elements of the range.
+            */
+            struct tail_finderF
+            {
+                // Construction
+                tail_finderF( int N ) : m_N(N) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    if(m_N>=0)
+                    {
+                        return ::ndnboost::algorithm::detail::find_tail_impl( Begin, End, m_N );
+                    }
+                    else
+                    {
+                        iterator_range<ForwardIteratorT> Res=
+                            ::ndnboost::algorithm::detail::find_head_impl( Begin, End, -m_N );
+
+                        return ::ndnboost::make_iterator_range(Res.end(), End);
+                    }
+                }
+
+            private:
+                int m_N;
+            };
+
+//  find token functor -----------------------------------------------//
+
+            // find a token in a sequence ( functor )
+            /*
+                This find functor finds a token specified be a predicate
+                in a sequence. It is equivalent of std::find algorithm,
+                with an exception that it return range instead of a single
+                iterator.
+
+                If bCompress is set to true, adjacent matching tokens are
+                concatenated into one match.
+            */
+            template< typename PredicateT >
+            struct token_finderF
+            {
+                // Construction
+                token_finderF(
+                    PredicateT Pred,
+                    token_compress_mode_type eCompress=token_compress_off ) :
+                        m_Pred(Pred), m_eCompress(eCompress) {}
+
+                // Operation
+                template< typename ForwardIteratorT >
+                iterator_range<ForwardIteratorT>
+                operator()(
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) const
+                {
+                    typedef iterator_range<ForwardIteratorT> result_type;
+
+                    ForwardIteratorT It=std::find_if( Begin, End, m_Pred );
+
+                    if( It==End )
+                    {
+                        return result_type( End, End );
+                    }
+                    else
+                    {
+                        ForwardIteratorT It2=It;
+
+                        if( m_eCompress==token_compress_on )
+                        {
+                            // Find first non-matching character
+                            while( It2!=End && m_Pred(*It2) ) ++It2;
+                        }
+                        else
+                        {
+                            // Advance by one position
+                            ++It2;
+                        }
+
+                        return result_type( It, It2 );
+                    }
+                }
+
+            private:
+                PredicateT m_Pred;
+                token_compress_mode_type m_eCompress;
+            };
+
+//  find range functor -----------------------------------------------//
+
+            // find a range in the sequence ( functor )
+            /*
+                This functor actually does not perform any find operation.
+                It always returns given iterator range as a result.
+            */
+            template<typename ForwardIterator1T>
+            struct range_finderF
+            {
+                typedef ForwardIterator1T input_iterator_type;
+                typedef iterator_range<input_iterator_type> result_type;
+
+                // Construction
+                range_finderF(
+                    input_iterator_type Begin,
+                    input_iterator_type End ) : m_Range(Begin, End) {}
+
+                range_finderF(const iterator_range<input_iterator_type>& Range) :
+                    m_Range(Range) {}
+
+                // Operation
+                template< typename ForwardIterator2T >
+                iterator_range<ForwardIterator2T>
+                operator()(
+                    ForwardIterator2T,
+                    ForwardIterator2T ) const
+                {
+#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) 
+                    return iterator_range<const ForwardIterator2T>(this->m_Range);
+#elif BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+                    return iterator_range<ForwardIterator2T>(m_Range.begin(), m_Range.end());
+#else
+                    return m_Range;
+#endif
+                }
+
+            private:
+                iterator_range<input_iterator_type> m_Range;
+            };
+
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_FINDER_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/formatter.hpp b/ndnboost/algorithm/string/detail/formatter.hpp
new file mode 100644
index 0000000..0307310
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/formatter.hpp
@@ -0,0 +1,119 @@
+//  Boost string_algo library formatter.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
+#define BOOST_STRING_FORMATTER_DETAIL_HPP
+
+
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+
+#include <ndnboost/algorithm/string/detail/util.hpp>
+
+//  generic replace functors -----------------------------------------------//
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+//  const format functor ----------------------------------------------------//
+
+            // constant format functor
+            template<typename RangeT>
+            struct const_formatF
+            {
+            private:
+                typedef BOOST_STRING_TYPENAME
+                    range_const_iterator<RangeT>::type format_iterator;
+                typedef iterator_range<format_iterator> result_type;
+            
+            public:
+                // Construction
+                const_formatF(const RangeT& Format) :
+                    m_Format(::ndnboost::begin(Format), ::ndnboost::end(Format)) {}
+
+                // Operation
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+                template<typename Range2T>
+                result_type& operator()(const Range2T&)
+                {
+                    return m_Format;
+                }
+#endif
+
+                template<typename Range2T>
+                const result_type& operator()(const Range2T&) const
+                {
+                    return m_Format;
+                }
+
+            private:
+                result_type m_Format;
+            };
+
+//  identity format functor ----------------------------------------------------//
+
+            // identity format functor
+            template<typename RangeT>
+            struct identity_formatF
+            {
+                // Operation
+                template< typename Range2T >
+                const RangeT& operator()(const Range2T& Replace) const
+                {
+                    return RangeT(::ndnboost::begin(Replace), ::ndnboost::end(Replace));
+                }
+            };
+
+//  empty format functor ( used by erase ) ------------------------------------//
+        
+            // empty format functor
+            template< typename CharT >
+            struct empty_formatF
+            {
+                template< typename ReplaceT >
+                empty_container<CharT> operator()(const ReplaceT&) const
+                {
+                    return empty_container<CharT>();
+                }
+            };
+
+//  dissect format functor ----------------------------------------------------//
+
+            // dissect format functor
+            template<typename FinderT>
+            struct dissect_formatF
+            {
+            public:
+                // Construction
+                dissect_formatF(FinderT Finder) :
+                  m_Finder(Finder) {}
+
+                  // Operation
+                  template<typename RangeT>
+                  inline iterator_range< 
+                      BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
+                  operator()(const RangeT& Replace) const
+                  {
+                      return m_Finder(::ndnboost::begin(Replace), ::ndnboost::end(Replace));
+                  }
+
+            private:
+                FinderT m_Finder;
+            };
+
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_FORMATTER_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/replace_storage.hpp b/ndnboost/algorithm/string/detail/replace_storage.hpp
new file mode 100644
index 0000000..6fb6c54
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/replace_storage.hpp
@@ -0,0 +1,159 @@
+//  Boost string_algo library replace_storage.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
+#define BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <algorithm>
+#include <ndnboost/mpl/bool.hpp>
+#include <ndnboost/algorithm/string/sequence_traits.hpp>
+#include <ndnboost/algorithm/string/detail/sequence.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+//  storage handling routines -----------------------------------------------//
+            
+            template< typename StorageT, typename OutputIteratorT >
+            inline OutputIteratorT move_from_storage(
+                StorageT& Storage,
+                OutputIteratorT DestBegin,
+                OutputIteratorT DestEnd )
+            {
+                OutputIteratorT OutputIt=DestBegin;
+                
+                while( !Storage.empty() && OutputIt!=DestEnd )
+                {
+                    *OutputIt=Storage.front();
+                    Storage.pop_front();
+                    ++OutputIt;
+                }
+
+                return OutputIt;
+            }
+
+            template< typename StorageT, typename WhatT >
+            inline void copy_to_storage(
+                StorageT& Storage,
+                const WhatT& What )
+            {
+                Storage.insert( Storage.end(), ::ndnboost::begin(What), ::ndnboost::end(What) );
+            }
+
+
+//  process segment routine -----------------------------------------------//
+
+            template< bool HasStableIterators >
+            struct process_segment_helper
+            {
+                // Optimized version of process_segment for generic sequence
+                template< 
+                    typename StorageT,
+                    typename InputT,
+                    typename ForwardIteratorT >
+                ForwardIteratorT operator()(
+                    StorageT& Storage,
+                    InputT& /*Input*/,
+                    ForwardIteratorT InsertIt,
+                    ForwardIteratorT SegmentBegin,
+                    ForwardIteratorT SegmentEnd )
+                {
+                    // Copy data from the storage until the beginning of the segment
+                    ForwardIteratorT It=::ndnboost::algorithm::detail::move_from_storage( Storage, InsertIt, SegmentBegin );
+
+                    // 3 cases are possible :
+                    //   a) Storage is empty, It==SegmentBegin
+                    //   b) Storage is empty, It!=SegmentBegin
+                    //   c) Storage is not empty
+
+                    if( Storage.empty() )
+                    {
+                        if( It==SegmentBegin )
+                        {
+                            // Case a) everything is grand, just return end of segment
+                            return SegmentEnd;
+                        }
+                        else
+                        {
+                            // Case b) move the segment backwards
+                            return std::copy( SegmentBegin, SegmentEnd, It );
+                        }
+                    }
+                    else
+                    {
+                        // Case c) -> shift the segment to the left and keep the overlap in the storage
+                        while( It!=SegmentEnd )
+                        {
+                            // Store value into storage
+                            Storage.push_back( *It );
+                            // Get the top from the storage and put it here
+                            *It=Storage.front();
+                            Storage.pop_front();
+
+                            // Advance
+                            ++It;
+                        }
+
+                        return It;
+                    }
+                }
+            };
+
+            template<>
+            struct process_segment_helper< true >
+            {
+                // Optimized version of process_segment for list-like sequence
+                template< 
+                    typename StorageT,
+                    typename InputT,
+                    typename ForwardIteratorT >
+                ForwardIteratorT operator()(
+                    StorageT& Storage,
+                    InputT& Input,
+                    ForwardIteratorT InsertIt,
+                    ForwardIteratorT SegmentBegin,
+                    ForwardIteratorT SegmentEnd )
+
+                {
+                    // Call replace to do the job
+                    ::ndnboost::algorithm::detail::replace( Input, InsertIt, SegmentBegin, Storage );
+                    // Empty the storage
+                    Storage.clear();
+                    // Iterators were not changed, simply return the end of segment
+                    return SegmentEnd;
+                }
+            };
+
+            // Process one segment in the replace_all algorithm
+            template< 
+                typename StorageT,
+                typename InputT,
+                typename ForwardIteratorT >
+            inline ForwardIteratorT process_segment(
+                StorageT& Storage,
+                InputT& Input,
+                ForwardIteratorT InsertIt,
+                ForwardIteratorT SegmentBegin,
+                ForwardIteratorT SegmentEnd )
+            {
+                return 
+                    process_segment_helper< 
+                        has_stable_iterators<InputT>::value>()(
+                                Storage, Input, InsertIt, SegmentBegin, SegmentEnd );
+            }
+            
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+#endif  // BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/detail/sequence.hpp b/ndnboost/algorithm/string/detail/sequence.hpp
new file mode 100644
index 0000000..0b39a8b
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/sequence.hpp
@@ -0,0 +1,200 @@
+//  Boost string_algo library sequence.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_DETAIL_SEQUENCE_HPP
+#define BOOST_STRING_DETAIL_SEQUENCE_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <ndnboost/mpl/bool.hpp>
+#include <ndnboost/mpl/logical.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+
+#include <ndnboost/algorithm/string/sequence_traits.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+//  insert helpers  -------------------------------------------------//
+        
+            template< typename InputT, typename ForwardIteratorT >
+            inline void insert(
+                InputT& Input,
+                BOOST_STRING_TYPENAME InputT::iterator At,
+                ForwardIteratorT Begin,
+                ForwardIteratorT End )
+            {
+                Input.insert( At, Begin, End );
+            }
+
+            template< typename InputT, typename InsertT >
+            inline void insert(
+                InputT& Input,
+                BOOST_STRING_TYPENAME InputT::iterator At,
+                const InsertT& Insert )
+            {
+                ::ndnboost::algorithm::detail::insert( Input, At, ::ndnboost::begin(Insert), ::ndnboost::end(Insert) );
+            }
+           
+//  erase helper  ---------------------------------------------------//
+
+            // Erase a range in the sequence
+            /*
+                Returns the iterator pointing just after the erase subrange
+            */
+            template< typename InputT >
+            inline typename InputT::iterator erase(
+                InputT& Input,
+                BOOST_STRING_TYPENAME InputT::iterator From,
+                BOOST_STRING_TYPENAME InputT::iterator To )
+            {
+                return Input.erase( From, To );
+            }
+
+//  replace helper implementation  ----------------------------------//
+
+            // Optimized version of replace for generic sequence containers
+            // Assumption: insert and erase are expensive
+            template< bool HasConstTimeOperations >
+            struct replace_const_time_helper
+            {
+                template< typename InputT, typename ForwardIteratorT >
+                void operator()(
+                    InputT& Input,
+                    BOOST_STRING_TYPENAME InputT::iterator From,
+                    BOOST_STRING_TYPENAME InputT::iterator To,
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End )
+                {
+                    // Copy data to the container ( as much as possible )
+                    ForwardIteratorT InsertIt=Begin;
+                    BOOST_STRING_TYPENAME InputT::iterator InputIt=From;
+                    for(; InsertIt!=End && InputIt!=To; InsertIt++, InputIt++ )
+                    {
+                        *InputIt=*InsertIt;
+                    }
+
+                    if ( InsertIt!=End )
+                    {
+                        // Replace sequence is longer, insert it
+                        Input.insert( InputIt, InsertIt, End );
+                    }
+                    else
+                    {
+                        if ( InputIt!=To )
+                        {
+                            // Replace sequence is shorter, erase the rest
+                            Input.erase( InputIt, To );
+                        }
+                    }
+                }
+            };
+
+            template<>
+            struct replace_const_time_helper< true >
+            {
+                // Const-time erase and insert methods -> use them
+                template< typename InputT, typename ForwardIteratorT >
+                void operator()(
+                    InputT& Input,
+                    BOOST_STRING_TYPENAME InputT::iterator From,
+                    BOOST_STRING_TYPENAME InputT::iterator To,
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) 
+                {
+                    BOOST_STRING_TYPENAME InputT::iterator At=Input.erase( From, To );
+                    if ( Begin!=End )
+                    {
+                        if(!Input.empty())
+                        {
+                            Input.insert( At, Begin, End );
+                        }
+                        else
+                        {
+                            Input.insert( Input.begin(), Begin, End );
+                        }
+                    }
+                }
+            };
+
+            // No native replace method
+            template< bool HasNative >
+            struct replace_native_helper
+            {
+                template< typename InputT, typename ForwardIteratorT >
+                void operator()(
+                    InputT& Input,
+                    BOOST_STRING_TYPENAME InputT::iterator From,
+                    BOOST_STRING_TYPENAME InputT::iterator To,
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End ) 
+                {
+                    replace_const_time_helper< 
+                        ndnboost::mpl::and_<
+                            has_const_time_insert<InputT>,
+                            has_const_time_erase<InputT> >::value >()(
+                        Input, From, To, Begin, End );
+                }
+            };
+
+            // Container has native replace method
+            template<>
+            struct replace_native_helper< true >
+            {
+                template< typename InputT, typename ForwardIteratorT >
+                void operator()(
+                    InputT& Input,
+                    BOOST_STRING_TYPENAME InputT::iterator From,
+                    BOOST_STRING_TYPENAME InputT::iterator To,
+                    ForwardIteratorT Begin,
+                    ForwardIteratorT End )
+                {
+                    Input.replace( From, To, Begin, End );
+                }
+            };
+
+//  replace helper  -------------------------------------------------//
+        
+            template< typename InputT, typename ForwardIteratorT >
+            inline void replace(
+                InputT& Input,
+                BOOST_STRING_TYPENAME InputT::iterator From,
+                BOOST_STRING_TYPENAME InputT::iterator To,
+                ForwardIteratorT Begin,
+                ForwardIteratorT End )
+            {
+                replace_native_helper< has_native_replace<InputT>::value >()(
+                    Input, From, To, Begin, End );
+            }
+
+            template< typename InputT, typename InsertT >
+            inline void replace(
+                InputT& Input,
+                BOOST_STRING_TYPENAME InputT::iterator From,
+                BOOST_STRING_TYPENAME InputT::iterator To,
+                const InsertT& Insert )
+            {
+                if(From!=To)
+                {
+                    ::ndnboost::algorithm::detail::replace( Input, From, To, ::ndnboost::begin(Insert), ::ndnboost::end(Insert) );
+                }
+                else
+                {
+                    ::ndnboost::algorithm::detail::insert( Input, From, ::ndnboost::begin(Insert), ::ndnboost::end(Insert) );
+                }
+            }
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_DETAIL_SEQUENCE_HPP
diff --git a/ndnboost/algorithm/string/detail/util.hpp b/ndnboost/algorithm/string/detail/util.hpp
new file mode 100644
index 0000000..fa34548
--- /dev/null
+++ b/ndnboost/algorithm/string/detail/util.hpp
@@ -0,0 +1,106 @@
+//  Boost string_algo library util.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_UTIL_DETAIL_HPP
+#define BOOST_STRING_UTIL_DETAIL_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+#include <functional>
+#include <ndnboost/range/iterator_range.hpp>
+
+namespace ndnboost {
+    namespace algorithm {
+        namespace detail {
+
+//  empty container  -----------------------------------------------//
+
+            //  empty_container 
+            /*
+                This class represents always empty container,
+                containing elements of type CharT.
+
+                It is supposed to be used in a const version only
+            */
+            template< typename CharT >
+            struct empty_container 
+            {
+                typedef empty_container<CharT> type;        
+                typedef CharT value_type;
+                typedef std::size_t size_type;
+                typedef std::ptrdiff_t difference_type;
+                typedef const value_type& reference;
+                typedef const value_type& const_reference;
+                typedef const value_type* iterator;
+                typedef const value_type* const_iterator;
+
+                
+                // Operations
+                const_iterator begin() const
+                {
+                    return reinterpret_cast<const_iterator>(0);
+                }
+
+                const_iterator end() const
+                {
+                    return reinterpret_cast<const_iterator>(0);
+                }
+
+                bool empty() const
+                {
+                    return false;
+                }
+
+                size_type size() const
+                {
+                    return 0;
+                }
+            };
+    
+//  bounded copy algorithm  -----------------------------------------------//
+
+            // Bounded version of the std::copy algorithm
+            template<typename InputIteratorT, typename OutputIteratorT>
+            inline OutputIteratorT bounded_copy(
+                InputIteratorT First, 
+                InputIteratorT Last, 
+                OutputIteratorT DestFirst,
+                OutputIteratorT DestLast )
+            {
+                InputIteratorT InputIt=First;
+                OutputIteratorT OutputIt=DestFirst;
+                for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ )
+                {
+                    *OutputIt=*InputIt;
+                }
+
+                return OutputIt;
+            }
+
+//  iterator range utilities -----------------------------------------//
+
+            // copy range functor
+            template< 
+                typename SeqT, 
+                typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator >
+            struct copy_iterator_rangeF : 
+                public std::unary_function< iterator_range<IteratorT>, SeqT >
+            {
+                SeqT operator()( const iterator_range<IteratorT>& Range ) const
+                {
+                    return copy_range<SeqT>(Range);
+                }
+            };
+
+        } // namespace detail
+    } // namespace algorithm
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_UTIL_DETAIL_HPP
diff --git a/ndnboost/algorithm/string/find_format.hpp b/ndnboost/algorithm/string/find_format.hpp
new file mode 100644
index 0000000..5352eba
--- /dev/null
+++ b/ndnboost/algorithm/string/find_format.hpp
@@ -0,0 +1,287 @@
+//  Boost string_algo library find_format.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FIND_FORMAT_HPP
+#define BOOST_STRING_FIND_FORMAT_HPP
+
+#include <deque>
+#include <ndnboost/detail/iterator.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+#include <ndnboost/range/as_literal.hpp>
+
+#include <ndnboost/algorithm/string/concept.hpp>
+#include <ndnboost/algorithm/string/detail/find_format.hpp>
+#include <ndnboost/algorithm/string/detail/find_format_all.hpp>
+
+/*! \file
+    Defines generic replace algorithms. Each algorithm replaces
+    part(s) of the input. The part to be replaced is looked up using a Finder object.
+    Result of finding is then used by a Formatter object to generate the replacement.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+// generic replace  -----------------------------------------------------------------//
+
+        //! Generic replace algorithm
+        /*!
+            Use the Finder to search for a substring. Use the Formatter to format
+            this substring and replace it in the input.
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+    
+            \param Output An output iterator to which the result will be copied
+            \param Input An input sequence
+            \param Finder A Finder object used to search for a match to be replaced
+            \param Formatter A Formatter object used to format a match
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template< 
+            typename OutputIteratorT,
+            typename RangeT,
+            typename FinderT,
+            typename FormatterT>
+        inline OutputIteratorT find_format_copy(
+            OutputIteratorT Output,
+            const RangeT& Input,
+            FinderT Finder,
+            FormatterT Formatter )
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT((
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT((
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
+                ));
+
+            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::ndnboost::as_literal(Input));
+
+            return detail::find_format_copy_impl(
+                Output,
+                lit_input,
+                Formatter,
+                Finder( ::ndnboost::begin(lit_input), ::ndnboost::end(lit_input) ) );
+        }
+
+        //! Generic replace algorithm
+        /*!
+            \overload
+        */
+        template< 
+            typename SequenceT, 
+            typename FinderT,
+            typename FormatterT>
+        inline SequenceT find_format_copy(
+            const SequenceT& Input,
+            FinderT Finder,
+            FormatterT Formatter )
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT((
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT((
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+
+            return detail::find_format_copy_impl(
+                Input,
+                Formatter,
+                Finder(::ndnboost::begin(Input), ::ndnboost::end(Input)));
+        }
+
+        //! Generic replace algorithm
+        /*!
+            Use the Finder to search for a substring. Use the Formatter to format
+            this substring and replace it in the input. The input is modified in-place.
+
+            \param Input An input sequence
+            \param Finder A Finder object used to search for a match to be replaced
+            \param Formatter A Formatter object used to format a match
+        */
+        template<
+            typename SequenceT,
+            typename FinderT,
+            typename FormatterT>
+        inline void find_format( 
+            SequenceT& Input,
+            FinderT Finder,
+            FormatterT Formatter)
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT((
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT(( 
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+
+            detail::find_format_impl(
+                Input,
+                Formatter,
+                Finder(::ndnboost::begin(Input), ::ndnboost::end(Input)));
+        }
+
+
+//  find_format_all generic ----------------------------------------------------------------//
+
+        //! Generic replace all algorithm
+        /*!
+            Use the Finder to search for a substring. Use the Formatter to format
+            this substring and replace it in the input. Repeat this for all matching
+            substrings.
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input sequence
+            \param Finder A Finder object used to search for a match to be replaced
+            \param Formatter A Formatter object used to format a match
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input
+
+             \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template< 
+            typename OutputIteratorT,
+            typename RangeT,
+            typename FinderT,
+            typename FormatterT>
+        inline OutputIteratorT find_format_all_copy(
+            OutputIteratorT Output,
+            const RangeT& Input,
+            FinderT Finder,
+            FormatterT Formatter)
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT(( 
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT(( 
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
+                ));
+
+            iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::ndnboost::as_literal(Input));
+
+            return detail::find_format_all_copy_impl(
+                Output,
+                lit_input,
+                Finder,
+                Formatter,
+                Finder(::ndnboost::begin(lit_input), ::ndnboost::end(lit_input)));
+        }
+
+        //! Generic replace all algorithm
+        /*!
+            \overload
+        */
+        template< 
+            typename SequenceT, 
+            typename FinderT,
+            typename FormatterT >
+        inline SequenceT find_format_all_copy(
+            const SequenceT& Input,
+            FinderT Finder,
+            FormatterT Formatter )
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT((
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT((
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+
+            return detail::find_format_all_copy_impl(
+                Input,
+                Finder,
+                Formatter,
+                Finder( ::ndnboost::begin(Input), ::ndnboost::end(Input) ) );
+        }
+
+        //! Generic replace all algorithm
+        /*!
+            Use the Finder to search for a substring. Use the Formatter to format
+            this substring and replace it in the input. Repeat this for all matching
+            substrings.The input is modified in-place.
+
+            \param Input An input sequence
+            \param Finder A Finder object used to search for a match to be replaced
+            \param Formatter A Formatter object used to format a match
+        */
+        template<
+            typename SequenceT,
+            typename FinderT,
+            typename FormatterT >
+        inline void find_format_all( 
+            SequenceT& Input,
+            FinderT Finder,
+            FormatterT Formatter )
+        {
+            // Concept check
+            BOOST_CONCEPT_ASSERT((
+                FinderConcept<
+                    FinderT,
+                    BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+            BOOST_CONCEPT_ASSERT((
+                FormatterConcept<
+                    FormatterT,
+                    FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
+                ));
+
+            detail::find_format_all_impl(
+                Input,
+                Finder,
+                Formatter,
+                Finder(::ndnboost::begin(Input), ::ndnboost::end(Input)));
+
+        }
+
+    } // namespace algorithm
+
+    // pull the names to the boost namespace
+    using algorithm::find_format_copy;
+    using algorithm::find_format;
+    using algorithm::find_format_all_copy;
+    using algorithm::find_format_all;
+
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_FIND_FORMAT_HPP
diff --git a/ndnboost/algorithm/string/finder.hpp b/ndnboost/algorithm/string/finder.hpp
new file mode 100644
index 0000000..420e015
--- /dev/null
+++ b/ndnboost/algorithm/string/finder.hpp
@@ -0,0 +1,270 @@
+//  Boost string_algo library finder.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2006.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FINDER_HPP
+#define BOOST_STRING_FINDER_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+#include <ndnboost/range/iterator.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+
+#include <ndnboost/algorithm/string/constants.hpp>
+#include <ndnboost/algorithm/string/detail/finder.hpp>
+#include <ndnboost/algorithm/string/compare.hpp>
+
+/*! \file
+    Defines Finder generators. Finder object is a functor which is able to 
+    find a substring matching a specific criteria in the input.
+    Finders are used as a pluggable components for replace, find 
+    and split facilities. This header contains generator functions 
+    for finders provided in this library.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+//  Finder generators ------------------------------------------//
+        
+        //! "First" finder 
+        /*!
+            Construct the \c first_finder. The finder searches for the first
+            occurrence of the string in a given input.
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param Search A substring to be searched for.
+            \param Comp An element comparison predicate
+            \return An instance of the \c first_finder object
+        */
+        template<typename RangeT>
+        inline detail::first_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            is_equal>
+        first_finder( const RangeT& Search )
+        {
+            return 
+                detail::first_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                        is_equal>( ::ndnboost::as_literal(Search), is_equal() ) ;
+        }
+
+        //! "First" finder
+        /*!
+            \overload
+        */
+        template<typename RangeT,typename PredicateT>
+        inline detail::first_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            PredicateT>
+        first_finder( 
+            const RangeT& Search, PredicateT Comp )
+        {
+            return 
+                detail::first_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                    PredicateT>( ::ndnboost::as_literal(Search), Comp );
+        }
+
+        //! "Last" finder
+        /*!
+            Construct the \c last_finder. The finder searches for the last
+            occurrence of the string in a given input.
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param Search A substring to be searched for.
+            \param Comp An element comparison predicate
+            \return An instance of the \c last_finder object
+        */
+        template<typename RangeT>
+        inline detail::last_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            is_equal>
+        last_finder( const RangeT& Search )
+        {
+            return 
+                detail::last_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                    is_equal>( ::ndnboost::as_literal(Search), is_equal() );
+        }
+        //! "Last" finder
+        /*!
+            \overload
+        */
+        template<typename RangeT, typename PredicateT>
+        inline detail::last_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            PredicateT>
+        last_finder( const RangeT& Search, PredicateT Comp )
+        {
+            return 
+                detail::last_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                    PredicateT>( ::ndnboost::as_literal(Search), Comp ) ;
+        }
+
+        //! "Nth" finder
+        /*!
+            Construct the \c nth_finder. The finder searches for the n-th (zero-indexed)
+            occurrence of the string in a given input.
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param Search A substring to be searched for.
+            \param Nth An index of the match to be find
+            \param Comp An element comparison predicate
+            \return An instance of the \c nth_finder object
+        */
+        template<typename RangeT>
+        inline detail::nth_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            is_equal>
+        nth_finder( 
+            const RangeT& Search, 
+            int Nth)
+        {
+            return 
+                detail::nth_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                    is_equal>( ::ndnboost::as_literal(Search), Nth, is_equal() ) ;
+        }
+        //! "Nth" finder
+        /*!
+            \overload
+        */
+        template<typename RangeT, typename PredicateT>
+        inline detail::nth_finderF<
+            BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
+            PredicateT>
+        nth_finder( 
+            const RangeT& Search, 
+            int Nth, 
+            PredicateT Comp )
+        {
+            return 
+                detail::nth_finderF<
+                    BOOST_STRING_TYPENAME 
+                        range_const_iterator<RangeT>::type,
+                    PredicateT>( ::ndnboost::as_literal(Search), Nth, Comp );
+        }
+
+        //! "Head" finder
+        /*!
+            Construct the \c head_finder. The finder returns a head of a given
+            input. The head is a prefix of a string up to n elements in
+            size. If an input has less then n elements, whole input is 
+            considered a head.
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param N The size of the head
+            \return An instance of the \c head_finder object
+        */
+        inline detail::head_finderF
+        head_finder( int N )
+        {
+            return detail::head_finderF(N);
+        }
+        
+        //! "Tail" finder
+        /*!
+            Construct the \c tail_finder. The finder returns a tail of a given
+            input. The tail is a suffix of a string up to n elements in
+            size. If an input has less then n elements, whole input is 
+            considered a head.
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param N The size of the head
+            \return An instance of the \c tail_finder object
+        */
+        inline detail::tail_finderF
+        tail_finder( int N )
+        {
+            return detail::tail_finderF(N);
+        }
+
+        //! "Token" finder
+        /*!
+            Construct the \c token_finder. The finder searches for a token 
+            specified by a predicate. It is similar to std::find_if 
+            algorithm, with an exception that it return a range of
+            instead of a single iterator.
+
+            If "compress token mode" is enabled, adjacent matching tokens are 
+            concatenated into one match. Thus the finder can be used to 
+            search for continuous segments of characters satisfying the 
+            given predicate.
+
+            The result is given as an \c iterator_range delimiting the match.
+
+            \param Pred An element selection predicate
+            \param eCompress Compress flag
+            \return An instance of the \c token_finder object
+        */
+        template< typename PredicateT >
+        inline detail::token_finderF<PredicateT>
+        token_finder( 
+            PredicateT Pred, 
+            token_compress_mode_type eCompress=token_compress_off )
+        {
+            return detail::token_finderF<PredicateT>( Pred, eCompress );
+        }
+
+        //! "Range" finder
+        /*!
+            Construct the \c range_finder. The finder does not perform 
+            any operation. It simply returns the given range for 
+            any input. 
+
+            \param Begin Beginning of the range
+            \param End End of the range
+            \param Range The range.
+            \return An instance of the \c range_finger object
+        */
+        template< typename ForwardIteratorT >
+        inline detail::range_finderF<ForwardIteratorT>
+        range_finder(
+            ForwardIteratorT Begin,
+            ForwardIteratorT End )
+        {
+            return detail::range_finderF<ForwardIteratorT>( Begin, End );
+        }
+
+        //! "Range" finder
+        /*!       
+            \overload
+        */
+        template< typename ForwardIteratorT >
+        inline detail::range_finderF<ForwardIteratorT>
+        range_finder( iterator_range<ForwardIteratorT> Range )
+        {
+            return detail::range_finderF<ForwardIteratorT>( Range );
+        }
+
+    } // namespace algorithm
+
+    // pull the names to the boost namespace
+    using algorithm::first_finder;
+    using algorithm::last_finder;
+    using algorithm::nth_finder;
+    using algorithm::head_finder;
+    using algorithm::tail_finder;
+    using algorithm::token_finder;
+    using algorithm::range_finder;
+
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_FINDER_HPP
diff --git a/ndnboost/algorithm/string/formatter.hpp b/ndnboost/algorithm/string/formatter.hpp
new file mode 100644
index 0000000..5739b40
--- /dev/null
+++ b/ndnboost/algorithm/string/formatter.hpp
@@ -0,0 +1,120 @@
+//  Boost string_algo library formatter.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_FORMATTER_HPP
+#define BOOST_STRING_FORMATTER_HPP
+
+#include <ndnboost/detail/iterator.hpp>
+#include <ndnboost/range/value_type.hpp>
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/as_literal.hpp>
+
+#include <ndnboost/algorithm/string/detail/formatter.hpp>
+
+/*! \file
+    Defines Formatter generators. Formatter is a functor which formats
+    a string according to given parameters. A Formatter works
+    in conjunction with a Finder. A Finder can provide additional information
+    for a specific Formatter. An example of such a cooperation is regex_finder
+    and regex_formatter.
+
+    Formatters are used as pluggable components for replace facilities. 
+    This header contains generator functions for the Formatters provided in this library.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+// generic formatters  ---------------------------------------------------------------//
+
+        //! Constant formatter
+        /*!
+            Constructs a \c const_formatter. Const formatter always returns
+            the same value, regardless of the parameter.
+
+            \param Format A predefined value used as a result for formatting
+            \return An instance of the \c const_formatter object.
+        */
+        template<typename RangeT>
+        inline detail::const_formatF<
+            iterator_range<
+                BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
+        const_formatter(const RangeT& Format)
+        {
+            return detail::const_formatF<
+                iterator_range<
+                    BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >(::ndnboost::as_literal(Format));
+        }
+
+        //! Identity formatter
+        /*!
+            Constructs an \c identity_formatter. Identity formatter always returns
+            the parameter.
+
+            \return An instance of the \c identity_formatter object.
+        */
+        template<typename RangeT>
+        inline detail::identity_formatF<
+            iterator_range<
+                BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
+        identity_formatter()
+        {
+            return detail::identity_formatF<
+                iterator_range<
+                    BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
+        }
+
+        //! Empty formatter
+        /*!
+            Constructs an \c empty_formatter. Empty formatter always returns an empty
+            sequence. 
+
+            \param Input container used to select a correct value_type for the
+                         resulting empty_container<>.
+            \return An instance of the \c empty_formatter object.
+        */
+        template<typename RangeT>
+        inline detail::empty_formatF< 
+            BOOST_STRING_TYPENAME range_value<RangeT>::type>
+        empty_formatter(const RangeT&)
+        {
+            return detail::empty_formatF<
+                BOOST_STRING_TYPENAME range_value<RangeT>::type>();
+        }
+
+        //! Empty formatter
+        /*!
+            Constructs a \c dissect_formatter. Dissect formatter uses a specified finder
+            to extract a portion of the formatted sequence. The first finder's match is returned 
+            as a result
+
+            \param Finder a finder used to select a portion of the formatted sequence
+            \return An instance of the \c dissect_formatter object.
+        */
+        template<typename FinderT>
+        inline detail::dissect_formatF< FinderT >
+        dissect_formatter(const FinderT& Finder)
+        {
+            return detail::dissect_formatF<FinderT>(Finder);
+        }
+
+
+    } // namespace algorithm
+
+    // pull the names to the boost namespace
+    using algorithm::const_formatter;
+    using algorithm::identity_formatter;
+    using algorithm::empty_formatter;
+    using algorithm::dissect_formatter;
+
+} // namespace ndnboost
+
+
+#endif  // BOOST_FORMATTER_HPP
diff --git a/ndnboost/algorithm/string/replace.hpp b/ndnboost/algorithm/string/replace.hpp
new file mode 100644
index 0000000..11afce4
--- /dev/null
+++ b/ndnboost/algorithm/string/replace.hpp
@@ -0,0 +1,928 @@
+//  Boost string_algo library replace.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2006.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_REPLACE_HPP
+#define BOOST_STRING_REPLACE_HPP
+
+#include <ndnboost/algorithm/string/config.hpp>
+
+#include <ndnboost/range/iterator_range.hpp>
+#include <ndnboost/range/begin.hpp>
+#include <ndnboost/range/end.hpp>
+#include <ndnboost/range/iterator.hpp>
+#include <ndnboost/range/const_iterator.hpp>
+
+#include <ndnboost/algorithm/string/find_format.hpp>
+#include <ndnboost/algorithm/string/finder.hpp>
+#include <ndnboost/algorithm/string/formatter.hpp>
+#include <ndnboost/algorithm/string/compare.hpp>
+
+/*! \file
+    Defines various replace algorithms. Each algorithm replaces
+    part(s) of the input according to set of searching and replace criteria.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+//  replace_range --------------------------------------------------------------------//
+
+        //! Replace range algorithm
+        /*!
+            Replace the given range in the input string.
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param SearchRange A range in the input to be substituted
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input
+
+              \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T>
+        inline OutputIteratorT replace_range_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const iterator_range<
+                BOOST_STRING_TYPENAME 
+                    range_const_iterator<Range1T>::type>& SearchRange,
+            const Range2T& Format)
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::range_finder(SearchRange),
+                ::ndnboost::algorithm::const_formatter(Format));
+        }
+
+        //! Replace range algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename RangeT>
+        inline SequenceT replace_range_copy( 
+            const SequenceT& Input,
+            const iterator_range<
+                BOOST_STRING_TYPENAME 
+                    range_const_iterator<SequenceT>::type>& SearchRange,
+            const RangeT& Format)
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Input,
+                ::ndnboost::algorithm::range_finder(SearchRange),
+                ::ndnboost::algorithm::const_formatter(Format));
+        }
+
+        //! Replace range algorithm
+        /*!
+            Replace the given range in the input string. 
+            The input sequence is modified in-place.
+
+            \param Input An input string
+            \param SearchRange A range in the input to be substituted
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename RangeT>
+        inline void replace_range( 
+            SequenceT& Input,
+            const iterator_range<
+                BOOST_STRING_TYPENAME 
+                    range_iterator<SequenceT>::type>& SearchRange,
+            const RangeT& Format)
+        {
+            ::ndnboost::algorithm::find_format(
+                Input,
+                ::ndnboost::algorithm::range_finder(SearchRange),
+                ::ndnboost::algorithm::const_formatter(Format));
+        }
+
+//  replace_first --------------------------------------------------------------------//
+
+        //! Replace first algorithm
+        /*!
+            Replace the first match of the search substring in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input
+
+              \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT replace_first_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format)
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace first algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT replace_first_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace first algorithm
+        /*!
+            replace the first match of the search substring in the input 
+            with the format string. The input sequence is modified in-place.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void replace_first( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_first ( case insensitive ) ---------------------------------------------//
+
+        //! Replace first algorithm ( case insensitive )
+        /*!
+            Replace the first match of the search substring in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            Searching is case insensitive.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input
+
+             \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT ireplace_first_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace first algorithm ( case insensitive )
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range2T, typename Range1T>
+        inline SequenceT ireplace_first_copy( 
+            const SequenceT& Input,
+            const Range2T& Search,
+            const Range1T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace first algorithm ( case insensitive )
+        /*!
+            Replace the first match of the search substring in the input 
+            with the format string. Input sequence is modified in-place.
+            Searching is case insensitive.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void ireplace_first( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_last --------------------------------------------------------------------//
+
+        //! Replace last algorithm
+        /*!
+            Replace the last match of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input            
+
+              \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT replace_last_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::last_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace last algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT replace_last_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::last_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace last algorithm
+        /*!
+            Replace the last match of the search string in the input 
+            with the format string. Input sequence is modified in-place.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void replace_last( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::last_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_last ( case insensitive ) -----------------------------------------------//
+
+        //! Replace last algorithm ( case insensitive )
+        /*!
+            Replace the last match of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            Searching is case insensitive.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input  
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT ireplace_last_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::last_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace last algorithm ( case insensitive )
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT ireplace_last_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::last_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace last algorithm ( case insensitive )
+        /*!
+            Replace the last match of the search string in the input 
+            with the format string.The input sequence is modified in-place.
+            Searching is case insensitive.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+            \return A reference to the modified input
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void ireplace_last( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::last_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_nth --------------------------------------------------------------------//
+
+        //! Replace nth algorithm
+        /*!
+            Replace an Nth (zero-indexed) match of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Nth An index of the match to be replaced. The index is 0-based.
+                For negative N, matches are counted from the end of string.
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT replace_nth_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            int Nth,
+            const Range3T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::nth_finder(Search, Nth),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace nth algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT replace_nth_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            int Nth,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::nth_finder(Search, Nth),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace nth algorithm
+        /*!
+            Replace an Nth (zero-indexed) match of the search string in the input 
+            with the format string. Input sequence is modified in-place.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Nth An index of the match to be replaced. The index is 0-based.
+                For negative N, matches are counted from the end of string.
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void replace_nth( 
+            SequenceT& Input,
+            const Range1T& Search,
+            int Nth,
+            const Range2T& Format )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::nth_finder(Search, Nth),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_nth ( case insensitive ) -----------------------------------------------//
+        
+        //! Replace nth algorithm ( case insensitive )
+        /*!
+            Replace an Nth (zero-indexed) match of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            Searching is case insensitive.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Nth An index of the match to be replaced. The index is 0-based.
+                For negative N, matches are counted from the end of string.
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input            
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+       */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT ireplace_nth_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            int Nth,
+            const Range3T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc) ),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace nth algorithm ( case insensitive )
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT ireplace_nth_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            int Nth,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace nth algorithm ( case insensitive )
+        /*!
+            Replace an Nth (zero-indexed) match of the search string in the input 
+            with the format string. Input sequence is modified in-place.
+            Searching is case insensitive.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Nth An index of the match to be replaced. The index is 0-based.
+                For negative N, matches are counted from the end of string.
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void ireplace_nth( 
+            SequenceT& Input,
+            const Range1T& Search,
+            int Nth,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_all --------------------------------------------------------------------//
+
+        //! Replace all algorithm
+        /*!
+            Replace all occurrences of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input 
+
+             \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT replace_all_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_all_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace all algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT replace_all_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_all_copy( 
+                Input,
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace all algorithm
+        /*!
+            Replace all occurrences of the search string in the input 
+            with the format string. The input sequence is modified in-place.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \return A reference to the modified input
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void replace_all( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format )
+        {
+            ::ndnboost::algorithm::find_format_all( 
+                Input, 
+                ::ndnboost::algorithm::first_finder(Search),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+        
+//  replace_all ( case insensitive ) -----------------------------------------------//
+
+        //! Replace all algorithm ( case insensitive )
+        /*!
+            Replace all occurrences of the search string in the input 
+            with the format string. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            Searching is case insensitive.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input 
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T,
+            typename Range3T>
+        inline OutputIteratorT ireplace_all_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            const Range2T& Search,
+            const Range3T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_all_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace all algorithm ( case insensitive )
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline SequenceT ireplace_all_copy( 
+            const SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            return ::ndnboost::algorithm::find_format_all_copy( 
+                Input,
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace all algorithm ( case insensitive )
+        /*!
+            Replace all occurrences of the search string in the input 
+            with the format string.The input sequence is modified in-place.
+            Searching is case insensitive.
+
+            \param Input An input string
+            \param Search A substring to be searched for 
+            \param Format A substitute string
+            \param Loc A locale used for case insensitive comparison
+        */
+        template<typename SequenceT, typename Range1T, typename Range2T>
+        inline void ireplace_all( 
+            SequenceT& Input,
+            const Range1T& Search,
+            const Range2T& Format,
+            const std::locale& Loc=std::locale() )
+        {
+            ::ndnboost::algorithm::find_format_all( 
+                Input, 
+                ::ndnboost::algorithm::first_finder(Search, is_iequal(Loc)),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+        
+//  replace_head --------------------------------------------------------------------//
+
+        //! Replace head algorithm
+        /*!
+            Replace the head of the input with the given format string. 
+            The head is a prefix of a string of given size. 
+            If the sequence is shorter then required, whole string if 
+            considered to be the head. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+            
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param N Length of the head.
+                For N>=0, at most N characters are extracted.
+                For N<0, size(Input)-|N| characters are extracted.
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                a modified copy of the input  
+
+            \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T>
+        inline OutputIteratorT replace_head_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            int N,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::head_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace head algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename RangeT>
+        inline SequenceT replace_head_copy( 
+            const SequenceT& Input,
+            int N,
+            const RangeT& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::head_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace head algorithm
+        /*!
+            Replace the head of the input with the given format string. 
+            The head is a prefix of a string of given size. 
+            If the sequence is shorter then required, the whole string is 
+            considered to be the head. The input sequence is modified in-place.
+
+            \param Input An input string
+            \param N Length of the head.
+                For N>=0, at most N characters are extracted.
+                For N<0, size(Input)-|N| characters are extracted.
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename RangeT>
+        inline void replace_head( 
+            SequenceT& Input,
+            int N,
+            const RangeT& Format )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::head_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+//  replace_tail --------------------------------------------------------------------//
+
+        //! Replace tail algorithm
+        /*!
+            Replace the tail of the input with the given format string. 
+            The tail is a suffix of a string of given size. 
+            If the sequence is shorter then required, whole string is 
+            considered to be the tail. 
+            The result is a modified copy of the input. It is returned as a sequence 
+            or copied to the output iterator.
+
+            \param Output An output iterator to which the result will be copied
+            \param Input An input string
+            \param N Length of the tail.
+                For N>=0, at most N characters are extracted.
+                For N<0, size(Input)-|N| characters are extracted.
+            \param Format A substitute string
+            \return An output iterator pointing just after the last inserted character or
+                    a modified copy of the input   
+
+              \note The second variant of this function provides the strong exception-safety guarantee
+        */
+        template<
+            typename OutputIteratorT,
+            typename Range1T, 
+            typename Range2T>
+        inline OutputIteratorT replace_tail_copy(
+            OutputIteratorT Output,
+            const Range1T& Input,
+            int N,
+            const Range2T& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy(
+                Output,
+                Input,
+                ::ndnboost::algorithm::tail_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace tail algorithm
+        /*!
+            \overload
+        */
+        template<typename SequenceT, typename RangeT>
+        inline SequenceT replace_tail_copy( 
+            const SequenceT& Input,
+            int N,
+            const RangeT& Format )
+        {
+            return ::ndnboost::algorithm::find_format_copy( 
+                Input,
+                ::ndnboost::algorithm::tail_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+        //! Replace tail algorithm
+        /*!
+            Replace the tail of the input with the given format sequence. 
+            The tail is a suffix of a string of given size. 
+            If the sequence is shorter then required, the whole string is 
+            considered to be the tail. The input sequence is modified in-place.
+
+            \param Input An input string
+            \param N Length of the tail.
+                For N>=0, at most N characters are extracted.
+                For N<0, size(Input)-|N| characters are extracted.
+            \param Format A substitute string
+        */
+        template<typename SequenceT, typename RangeT>
+        inline void replace_tail( 
+            SequenceT& Input,
+            int N,
+            const RangeT& Format )
+        {
+            ::ndnboost::algorithm::find_format( 
+                Input, 
+                ::ndnboost::algorithm::tail_finder(N),
+                ::ndnboost::algorithm::const_formatter(Format) );
+        }
+
+    } // namespace algorithm
+
+    // pull names to the boost namespace
+    using algorithm::replace_range_copy;
+    using algorithm::replace_range;
+    using algorithm::replace_first_copy;
+    using algorithm::replace_first;
+    using algorithm::ireplace_first_copy;
+    using algorithm::ireplace_first;
+    using algorithm::replace_last_copy;
+    using algorithm::replace_last;
+    using algorithm::ireplace_last_copy;
+    using algorithm::ireplace_last;
+    using algorithm::replace_nth_copy;
+    using algorithm::replace_nth;
+    using algorithm::ireplace_nth_copy;
+    using algorithm::ireplace_nth;
+    using algorithm::replace_all_copy;
+    using algorithm::replace_all;
+    using algorithm::ireplace_all_copy;
+    using algorithm::ireplace_all;
+    using algorithm::replace_head_copy;
+    using algorithm::replace_head;
+    using algorithm::replace_tail_copy;
+    using algorithm::replace_tail;
+
+} // namespace ndnboost
+
+#endif  // BOOST_REPLACE_HPP
diff --git a/ndnboost/algorithm/string/sequence_traits.hpp b/ndnboost/algorithm/string/sequence_traits.hpp
new file mode 100644
index 0000000..5ef46af
--- /dev/null
+++ b/ndnboost/algorithm/string/sequence_traits.hpp
@@ -0,0 +1,193 @@
+//  Boost string_algo library sequence_traits.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP
+#define BOOST_STRING_SEQUENCE_TRAITS_HPP
+
+#include <ndnboost/config.hpp>
+#include <ndnboost/mpl/bool.hpp>
+#include <ndnboost/algorithm/string/yes_no_type.hpp>
+
+/*! \file
+    Traits defined in this header are used by various algorithms to achieve
+    better performance for specific containers.
+    Traits provide fail-safe defaults. If a container supports some of these
+    features, it is possible to specialize the specific trait for this container.
+    For lacking compilers, it is possible of define an override for a specific tester
+    function.
+
+    Due to a language restriction, it is not currently possible to define specializations for
+    stl containers without including the corresponding header. To decrease the overhead
+    needed by this inclusion, user can selectively include a specialization
+    header for a specific container. They are located in boost/algorithm/string/stl
+    directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
+    header which contains specializations for all stl containers.
+*/
+
+namespace ndnboost {
+    namespace algorithm {
+
+//  sequence traits  -----------------------------------------------//
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+        //! Native replace tester
+        /*!
+            Declare an override of this tester function with return
+            type ndnboost::string_algo::yes_type for a sequence with this property.
+
+            \return yes_type if the container has basic_string like native replace
+            method.
+        */
+        no_type has_native_replace_tester(...);
+
+        //! Stable iterators tester
+        /*!
+            Declare an override of this tester function with return
+            type ndnboost::string_algo::yes_type for a sequence with this property.
+
+            \return yes_type if the sequence's insert/replace/erase methods do not invalidate
+            existing iterators.
+        */
+        no_type has_stable_iterators_tester(...);
+
+        //! const time insert tester
+        /*!
+            Declare an override of this tester function with return
+            type ndnboost::string_algo::yes_type for a sequence with this property.
+
+            \return yes_type if the sequence's insert method is working in constant time
+        */
+        no_type has_const_time_insert_tester(...);
+
+        //! const time erase tester
+        /*!
+            Declare an override of this tester function with return
+            type ndnboost::string_algo::yes_type for a sequence with this property.
+
+            \return yes_type if the sequence's erase method is working in constant time
+        */
+        no_type has_const_time_erase_tester(...);
+
+#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+        //! Native replace trait
+        /*!
+            This trait specifies that the sequence has \c std::string like replace method
+        */
+        template< typename T >
+        class has_native_replace
+        {
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        private:
+            static T* t;
+        public:
+            BOOST_STATIC_CONSTANT(bool, value=(
+                sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
+#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        public:
+#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+            enum { value = false };
+#    else
+            BOOST_STATIC_CONSTANT(bool, value=false);
+#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+
+            typedef mpl::bool_<has_native_replace<T>::value> type;
+        };
+
+
+        //! Stable iterators trait
+        /*!
+            This trait specifies that the sequence has stable iterators. It means
+            that operations like insert/erase/replace do not invalidate iterators.
+        */
+        template< typename T >
+        class has_stable_iterators
+        {
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        private:
+            static T* t;
+        public:
+            BOOST_STATIC_CONSTANT(bool, value=(
+                sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
+#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        public:
+#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+            enum { value = false };
+#    else
+            BOOST_STATIC_CONSTANT(bool, value=false);
+#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+            typedef mpl::bool_<has_stable_iterators<T>::value> type;
+        };
+
+
+        //! Const time insert trait
+        /*!
+            This trait specifies that the sequence's insert method has
+            constant time complexity.
+        */
+        template< typename T >
+        class has_const_time_insert
+        {
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        private:
+            static T* t;
+        public:
+            BOOST_STATIC_CONSTANT(bool, value=(
+                sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) );
+#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        public:
+#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+            enum { value = false };
+#    else
+            BOOST_STATIC_CONSTANT(bool, value=false);
+#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+            typedef mpl::bool_<has_const_time_insert<T>::value> type;
+        };
+
+
+        //! Const time erase trait
+        /*!
+            This trait specifies that the sequence's erase method has
+            constant time complexity.
+        */
+        template< typename T >
+        class has_const_time_erase
+        {
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        private:
+            static T* t;
+        public:
+            BOOST_STATIC_CONSTANT(bool, value=(
+                sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) );
+#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+        public:
+#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+            enum { value = false };
+#    else
+            BOOST_STATIC_CONSTANT(bool, value=false);
+#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+            typedef mpl::bool_<has_const_time_erase<T>::value> type;
+        };
+
+    } // namespace algorithm
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_SEQUENCE_TRAITS_HPP
diff --git a/ndnboost/algorithm/string/yes_no_type.hpp b/ndnboost/algorithm/string/yes_no_type.hpp
new file mode 100644
index 0000000..740c7b1
--- /dev/null
+++ b/ndnboost/algorithm/string/yes_no_type.hpp
@@ -0,0 +1,33 @@
+//  Boost string_algo library yes_no_type.hpp header file  ---------------------------//
+
+//  Copyright Pavol Droba 2002-2003.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/ for updates, documentation, and revision history.
+
+#ifndef BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
+#define BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
+
+namespace ndnboost {
+    namespace algorithm {
+
+        // taken from boost mailing-list
+        // when yes_no_type will become officially
+        // a part of boost distribution, this header
+        // will be deprecated
+        template<int I> struct size_descriptor 
+        {
+            typedef char (& type)[I];
+        }; 
+
+        typedef size_descriptor<1>::type yes_type;
+        typedef size_descriptor<2>::type no_type;
+
+    } // namespace algorithm
+} // namespace ndnboost
+
+
+#endif  // BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
