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
