Squashed 'third_party/boostorg/detail/' content from commit 824721a

Change-Id: Id58ef7955aa7ca41b9e6b3f41ee1b0ad900985ea
git-subtree-dir: third_party/boostorg/detail
git-subtree-split: 824721a7533de893338ed5bbc8e8d9f4fb1ad716
diff --git a/include/boost/detail/allocator_utilities.hpp b/include/boost/detail/allocator_utilities.hpp
new file mode 100644
index 0000000..11eecbe
--- /dev/null
+++ b/include/boost/detail/allocator_utilities.hpp
@@ -0,0 +1,192 @@
+/* Copyright 2003-2013 Joaquin M Lopez Munoz.
+ * 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 Boost website at http://www.boost.org/
+ */
+
+#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
+#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
+
+#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
+#include <boost/detail/workaround.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <cstddef>
+#include <memory>
+#include <new>
+
+namespace boost{
+
+namespace detail{
+
+/* Allocator adaption layer. Some stdlibs provide allocators without rebind
+ * and template ctors. These facilities are simulated with the external
+ * template class rebind_to and the aid of partial_std_allocator_wrapper.
+ */
+
+namespace allocator{
+
+/* partial_std_allocator_wrapper inherits the functionality of a std
+ * allocator while providing a templatized ctor and other bits missing
+ * in some stdlib implementation or another.
+ */
+
+template<typename Type>
+class partial_std_allocator_wrapper:public std::allocator<Type>
+{
+public:
+  /* Oddly enough, STLport does not define std::allocator<void>::value_type
+   * when configured to work without partial template specialization.
+   * No harm in supplying the definition here unconditionally.
+   */
+
+  typedef Type value_type;
+
+  partial_std_allocator_wrapper(){};
+
+  template<typename Other>
+  partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){}
+
+  partial_std_allocator_wrapper(const std::allocator<Type>& x):
+    std::allocator<Type>(x)
+  {
+  };
+
+#if defined(BOOST_DINKUMWARE_STDLIB)
+  /* Dinkumware guys didn't provide a means to call allocate() without
+   * supplying a hint, in disagreement with the standard.
+   */
+
+  Type* allocate(std::size_t n,const void* hint=0)
+  {
+    std::allocator<Type>& a=*this;
+    return a.allocate(n,hint);
+  }
+#endif
+
+};
+
+/* Detects whether a given allocator belongs to a defective stdlib not
+ * having the required member templates.
+ * Note that it does not suffice to check the Boost.Config stdlib
+ * macros, as the user might have passed a custom, compliant allocator.
+ * The checks also considers partial_std_allocator_wrapper to be
+ * a standard defective allocator.
+ */
+
+#if defined(BOOST_NO_STD_ALLOCATOR)&&\
+  (defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB))
+
+template<typename Allocator>
+struct is_partial_std_allocator
+{
+  BOOST_STATIC_CONSTANT(bool,
+    value=
+      (is_same<
+        std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
+        Allocator
+      >::value)||
+      (is_same<
+        partial_std_allocator_wrapper<
+          BOOST_DEDUCED_TYPENAME Allocator::value_type>,
+        Allocator
+      >::value));
+};
+
+#else
+
+template<typename Allocator>
+struct is_partial_std_allocator
+{
+  BOOST_STATIC_CONSTANT(bool,value=false);
+};
+
+#endif
+
+/* rebind operations for defective std allocators */
+
+template<typename Allocator,typename Type>
+struct partial_std_allocator_rebind_to
+{
+  typedef partial_std_allocator_wrapper<Type> type;
+};
+
+/* rebind operation in all other cases */
+
+template<typename Allocator>
+struct rebinder
+{
+  template<typename Type>
+  struct result
+  {
+#ifdef BOOST_NO_CXX11_ALLOCATOR
+      typedef typename Allocator::BOOST_NESTED_TEMPLATE
+          rebind<Type>::other other;
+#else
+      typedef typename std::allocator_traits<Allocator>::BOOST_NESTED_TEMPLATE
+          rebind_alloc<Type> other;
+#endif
+  };
+};
+
+template<typename Allocator,typename Type>
+struct compliant_allocator_rebind_to
+{
+  typedef typename rebinder<Allocator>::
+      BOOST_NESTED_TEMPLATE result<Type>::other type;
+};
+
+/* rebind front-end */
+
+template<typename Allocator,typename Type>
+struct rebind_to:
+  mpl::eval_if_c<
+    is_partial_std_allocator<Allocator>::value,
+    partial_std_allocator_rebind_to<Allocator,Type>,
+    compliant_allocator_rebind_to<Allocator,Type>
+  >
+{
+};
+
+/* allocator-independent versions of construct and destroy */
+
+template<typename Type>
+void construct(void* p,const Type& t)
+{
+  new (p) Type(t);
+}
+
+#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
+/* MSVC++ issues spurious warnings about unreferencend formal parameters
+ * in destroy<Type> when Type is a class with trivial dtor.
+ */
+
+#pragma warning(push)
+#pragma warning(disable:4100)
+#endif
+
+template<typename Type>
+void destroy(const Type* p)
+{
+
+#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
+  const_cast<Type*>(p)->~Type();
+#else
+  p->~Type();
+#endif
+
+}
+
+#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
+#pragma warning(pop)
+#endif
+
+} /* namespace boost::detail::allocator */
+
+} /* namespace boost::detail */
+
+} /* namespace boost */
+
+#endif
diff --git a/include/boost/detail/binary_search.hpp b/include/boost/detail/binary_search.hpp
new file mode 100644
index 0000000..3dca9b6
--- /dev/null
+++ b/include/boost/detail/binary_search.hpp
@@ -0,0 +1,216 @@
+// Copyright (c)  2000 David Abrahams. 
+// 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)
+// 
+// Copyright (c) 1994
+// Hewlett-Packard Company
+// 
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation.  Hewlett-Packard Company makes no
+// representations about the suitability of this software for any
+// purpose.  It is provided "as is" without express or implied warranty.
+// 
+// Copyright (c) 1996
+// Silicon Graphics Computer Systems, Inc.
+// 
+// Permission to use, copy, modify, distribute and sell this software
+// and its documentation for any purpose is hereby granted without fee,
+// provided that the above copyright notice appear in all copies and
+// that both that copyright notice and this permission notice appear
+// in supporting documentation.  Silicon Graphics makes no
+// representations about the suitability of this software for any
+// purpose.  It is provided "as is" without express or implied warranty.
+// 
+#ifndef BINARY_SEARCH_DWA_122600_H_
+# define BINARY_SEARCH_DWA_122600_H_
+
+# include <boost/detail/iterator.hpp>
+# include <utility>
+
+namespace boost { namespace detail {
+
+template <class ForwardIter, class Tp>
+ForwardIter lower_bound(ForwardIter first, ForwardIter last,
+                             const Tp& val) 
+{
+    typedef detail::iterator_traits<ForwardIter> traits;
+    
+    typename traits::difference_type len = boost::detail::distance(first, last);
+    typename traits::difference_type half;
+    ForwardIter middle;
+
+    while (len > 0) {
+      half = len >> 1;
+      middle = first;
+      std::advance(middle, half);
+      if (*middle < val) {
+        first = middle;
+        ++first;
+        len = len - half - 1;
+      }
+      else
+        len = half;
+    }
+    return first;
+}
+
+template <class ForwardIter, class Tp, class Compare>
+ForwardIter lower_bound(ForwardIter first, ForwardIter last,
+                              const Tp& val, Compare comp)
+{
+  typedef detail::iterator_traits<ForwardIter> traits;
+
+  typename traits::difference_type len = boost::detail::distance(first, last);
+  typename traits::difference_type half;
+  ForwardIter middle;
+
+  while (len > 0) {
+    half = len >> 1;
+    middle = first;
+    std::advance(middle, half);
+    if (comp(*middle, val)) {
+      first = middle;
+      ++first;
+      len = len - half - 1;
+    }
+    else
+      len = half;
+  }
+  return first;
+}
+
+template <class ForwardIter, class Tp>
+ForwardIter upper_bound(ForwardIter first, ForwardIter last,
+                           const Tp& val)
+{
+  typedef detail::iterator_traits<ForwardIter> traits;
+
+  typename traits::difference_type len = boost::detail::distance(first, last);
+  typename traits::difference_type half;
+  ForwardIter middle;
+
+  while (len > 0) {
+    half = len >> 1;
+    middle = first;
+    std::advance(middle, half);
+    if (val < *middle)
+      len = half;
+    else {
+      first = middle;
+      ++first;
+      len = len - half - 1;
+    }
+  }
+  return first;
+}
+
+template <class ForwardIter, class Tp, class Compare>
+ForwardIter upper_bound(ForwardIter first, ForwardIter last,
+                           const Tp& val, Compare comp)
+{
+  typedef detail::iterator_traits<ForwardIter> traits;
+
+  typename traits::difference_type len = boost::detail::distance(first, last);
+  typename traits::difference_type half;
+  ForwardIter middle;
+
+  while (len > 0) {
+    half = len >> 1;
+    middle = first;
+    std::advance(middle, half);
+    if (comp(val, *middle))
+      len = half;
+    else {
+      first = middle;
+      ++first;
+      len = len - half - 1;
+    }
+  }
+  return first;
+}
+
+template <class ForwardIter, class Tp>
+std::pair<ForwardIter, ForwardIter>
+equal_range(ForwardIter first, ForwardIter last, const Tp& val)
+{
+  typedef detail::iterator_traits<ForwardIter> traits;
+
+  typename traits::difference_type len = boost::detail::distance(first, last);
+  typename traits::difference_type half;
+  ForwardIter middle, left, right;
+
+  while (len > 0) {
+    half = len >> 1;
+    middle = first;
+    std::advance(middle, half);
+    if (*middle < val) {
+      first = middle;
+      ++first;
+      len = len - half - 1;
+    }
+    else if (val < *middle)
+      len = half;
+    else {
+      left = boost::detail::lower_bound(first, middle, val);
+      std::advance(first, len);
+      right = boost::detail::upper_bound(++middle, first, val);
+      return std::pair<ForwardIter, ForwardIter>(left, right);
+    }
+  }
+  return std::pair<ForwardIter, ForwardIter>(first, first);
+}
+
+template <class ForwardIter, class Tp, class Compare>
+std::pair<ForwardIter, ForwardIter>
+equal_range(ForwardIter first, ForwardIter last, const Tp& val,
+              Compare comp)
+{
+  typedef detail::iterator_traits<ForwardIter> traits;
+
+  typename traits::difference_type len = boost::detail::distance(first, last);
+  typename traits::difference_type half;
+  ForwardIter middle, left, right;
+
+  while (len > 0) {
+    half = len >> 1;
+    middle = first;
+    std::advance(middle, half);
+    if (comp(*middle, val)) {
+      first = middle;
+      ++first;
+      len = len - half - 1;
+    }
+    else if (comp(val, *middle))
+      len = half;
+    else {
+      left = boost::detail::lower_bound(first, middle, val, comp);
+      std::advance(first, len);
+      right = boost::detail::upper_bound(++middle, first, val, comp);
+      return std::pair<ForwardIter, ForwardIter>(left, right);
+    }
+  }
+  return std::pair<ForwardIter, ForwardIter>(first, first);
+}           
+
+template <class ForwardIter, class Tp>
+bool binary_search(ForwardIter first, ForwardIter last,
+                   const Tp& val) {
+  ForwardIter i = boost::detail::lower_bound(first, last, val);
+  return i != last && !(val < *i);
+}
+
+template <class ForwardIter, class Tp, class Compare>
+bool binary_search(ForwardIter first, ForwardIter last,
+                   const Tp& val,
+                   Compare comp) {
+  ForwardIter i = boost::detail::lower_bound(first, last, val, comp);
+  return i != last && !comp(val, *i);
+}
+
+}} // namespace boost::detail
+
+#endif // BINARY_SEARCH_DWA_122600_H_
diff --git a/include/boost/detail/bitmask.hpp b/include/boost/detail/bitmask.hpp
new file mode 100644
index 0000000..63d4fac
--- /dev/null
+++ b/include/boost/detail/bitmask.hpp
@@ -0,0 +1,58 @@
+//  boost/detail/bitmask.hpp  ------------------------------------------------//
+
+//  Copyright Beman Dawes 2006
+
+//  Distributed under the Boost Software License, Version 1.0
+//  http://www.boost.org/LICENSE_1_0.txt
+
+//  Usage:  enum foo { a=1, b=2, c=4 };
+//          BOOST_BITMASK( foo )
+//
+//          void f( foo arg );
+//          ...
+//          f( a | c );
+//
+//  See [bitmask.types] in the C++ standard for the formal specification
+
+#ifndef BOOST_BITMASK_HPP
+#define BOOST_BITMASK_HPP
+
+#include <boost/config.hpp>
+#include <boost/cstdint.hpp>
+
+#define BOOST_BITMASK(Bitmask)                                            \
+                                                                          \
+  inline BOOST_CONSTEXPR Bitmask operator| (Bitmask x , Bitmask y )       \
+  { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x)     \
+      | static_cast<boost::int_least32_t>(y)); }                          \
+                                                                          \
+  inline BOOST_CONSTEXPR Bitmask operator& (Bitmask x , Bitmask y )       \
+  { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x)     \
+      & static_cast<boost::int_least32_t>(y)); }                          \
+                                                                          \
+  inline BOOST_CONSTEXPR Bitmask operator^ (Bitmask x , Bitmask y )       \
+  { return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x)     \
+      ^ static_cast<boost::int_least32_t>(y)); }                          \
+                                                                          \
+  inline BOOST_CONSTEXPR Bitmask operator~ (Bitmask x )                   \
+  { return static_cast<Bitmask>(~static_cast<boost::int_least32_t>(x)); } \
+                                                                          \
+  inline Bitmask & operator&=(Bitmask& x , Bitmask y)                     \
+  { x = x & y ; return x ; }                                              \
+                                                                          \
+  inline Bitmask & operator|=(Bitmask& x , Bitmask y)                     \
+  { x = x | y ; return x ; }                                              \
+                                                                          \
+  inline Bitmask & operator^=(Bitmask& x , Bitmask y)                     \
+  { x = x ^ y ; return x ; }                                              \
+                                                                          \
+  /* Boost extensions to [bitmask.types] */                               \
+                                                                          \
+  inline BOOST_CONSTEXPR bool operator!(Bitmask x)                        \
+  { return !static_cast<int>(x); }                                        \
+                                                                          \
+  inline BOOST_CONSTEXPR bool bitmask_set(Bitmask x)                      \
+  { return !!x; }
+
+#endif // BOOST_BITMASK_HPP
+
diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp
new file mode 100644
index 0000000..823ebd1
--- /dev/null
+++ b/include/boost/detail/catch_exceptions.hpp
@@ -0,0 +1,142 @@
+//  boost/catch_exceptions.hpp -----------------------------------------------//
+
+//  Copyright Beman Dawes 1995-2001.  Distributed under the Boost
+//  Software License, Version 1.0. (See accompanying file
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org/libs/test for documentation.
+
+//  Revision History
+//   13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones)
+//   26 Feb 01 Numerous changes suggested during formal review. (Beman)
+//   25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
+//   22 Jan 01 Remove test_tools dependencies to reduce coupling.
+//    5 Nov 00 Initial boost version (Beman Dawes)
+
+#ifndef BOOST_CATCH_EXCEPTIONS_HPP
+#define BOOST_CATCH_EXCEPTIONS_HPP
+
+//  header dependencies are deliberately restricted to the standard library
+//  to reduce coupling to other boost libraries.
+#include <string>             // for string
+#include <new>                // for bad_alloc
+#include <typeinfo>           // for bad_cast, bad_typeid
+#include <exception>          // for exception, bad_exception
+#include <stdexcept>          // for std exception hierarchy
+#include <boost/cstdlib.hpp>  // for exit codes
+#include <ostream>         // for ostream
+
+# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551)
+#   define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT 
+# endif
+
+#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890)
+#   define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT 
+    namespace std { class bad_typeid { }; }
+# endif
+
+namespace boost
+{
+
+  namespace detail
+  {
+    //  A separate reporting function was requested during formal review.
+    inline void report_exception( std::ostream & os, 
+                                  const char * name, const char * info )
+      { os << "\n** uncaught exception: " << name << " " << info << std::endl; }
+  }
+
+  //  catch_exceptions  ------------------------------------------------------//
+
+  template< class Generator >  // Generator is function object returning int
+  int catch_exceptions( Generator function_object,
+                        std::ostream & out, std::ostream & err )
+  {
+    int result = 0;               // quiet compiler warnings
+    bool exception_thrown = true; // avoid setting result for each excptn type
+
+#ifndef BOOST_NO_EXCEPTIONS
+    try
+    {
+#endif
+      result = function_object();
+      exception_thrown = false;
+#ifndef BOOST_NO_EXCEPTIONS
+    }
+
+    //  As a result of hard experience with strangely interleaved output
+    //  under some compilers, there is a lot of use of endl in the code below
+    //  where a simple '\n' might appear to do.
+
+    //  The rules for catch & arguments are a bit different from function 
+    //  arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
+    //  required, but it doesn't hurt and some programmers ask for it.
+
+    catch ( const char * ex )
+      { detail::report_exception( out, "", ex ); }
+    catch ( const std::string & ex )
+      { detail::report_exception( out, "", ex.c_str() ); }
+
+    //  std:: exceptions
+    catch ( const std::bad_alloc & ex )
+      { detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
+
+# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
+    catch ( const std::bad_cast & ex )
+      { detail::report_exception( out, "std::bad_cast:", ex.what() ); }
+    catch ( const std::bad_typeid & ex )
+      { detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
+# else
+    catch ( const std::bad_cast & )
+      { detail::report_exception( out, "std::bad_cast", "" ); }
+    catch ( const std::bad_typeid & )
+      { detail::report_exception( out, "std::bad_typeid", "" ); }
+# endif
+
+    catch ( const std::bad_exception & ex )
+      { detail::report_exception( out, "std::bad_exception:", ex.what() ); }
+    catch ( const std::domain_error & ex )
+      { detail::report_exception( out, "std::domain_error:", ex.what() ); }
+    catch ( const std::invalid_argument & ex )
+      { detail::report_exception( out, "std::invalid_argument:", ex.what() ); }
+    catch ( const std::length_error & ex )
+      { detail::report_exception( out, "std::length_error:", ex.what() ); }
+    catch ( const std::out_of_range & ex )
+      { detail::report_exception( out, "std::out_of_range:", ex.what() ); }
+    catch ( const std::range_error & ex )
+      { detail::report_exception( out, "std::range_error:", ex.what() ); }
+    catch ( const std::overflow_error & ex )
+      { detail::report_exception( out, "std::overflow_error:", ex.what() ); }
+    catch ( const std::underflow_error & ex )
+      { detail::report_exception( out, "std::underflow_error:", ex.what() ); }
+    catch ( const std::logic_error & ex )
+      { detail::report_exception( out, "std::logic_error:", ex.what() ); }
+    catch ( const std::runtime_error & ex )
+      { detail::report_exception( out, "std::runtime_error:", ex.what() ); }
+    catch ( const std::exception & ex )
+      { detail::report_exception( out, "std::exception:", ex.what() ); }
+
+    catch ( ... )
+      { detail::report_exception( out, "unknown exception", "" ); }
+#endif // BOOST_NO_EXCEPTIONS
+
+    if ( exception_thrown ) result = boost::exit_exception_failure;
+
+    if ( result != 0 && result != exit_success )
+    {
+      out << std::endl << "**** returning with error code "
+                << result << std::endl;
+      err
+        << "**********  errors detected; see stdout for details  ***********"
+        << std::endl;
+    }
+#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
+    else { out << std::flush << "no errors detected" << std::endl; }
+#endif
+    return result;
+  } // catch_exceptions
+
+} // boost
+
+#endif  // BOOST_CATCH_EXCEPTIONS_HPP
+
diff --git a/include/boost/detail/container_fwd.hpp b/include/boost/detail/container_fwd.hpp
new file mode 100644
index 0000000..04ce972
--- /dev/null
+++ b/include/boost/detail/container_fwd.hpp
@@ -0,0 +1,157 @@
+
+// Copyright 2005-2011 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// Note: if you change this include guard, you also need to change
+// container_fwd_compile_fail.cpp
+#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP)
+#define BOOST_DETAIL_CONTAINER_FWD_HPP
+
+#if defined(_MSC_VER) && \
+    !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+// Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to      //
+// forward declare standard containers.                                       //
+//                                                                            //
+// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it //
+// normally doesn't.                                                          //
+//                                                                            //
+// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD.        //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
+#  if defined(BOOST_DETAIL_CONTAINER_FWD)
+     // Force forward declarations.
+#  elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+     // STLport
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif defined(__LIBCOMO__)
+     // Comeau STL:
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
+     // Rogue Wave library:
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif defined(_LIBCPP_VERSION)
+     // libc++
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+     // GNU libstdc++ 3
+     //
+     // Disable forwarding for all recent versions, as the library has a
+     // versioned namespace mode, and I don't know how to detect it.
+#    if __GLIBCXX__ >= 20070513 \
+        || defined(_GLIBCXX_DEBUG) \
+        || defined(_GLIBCXX_PARALLEL) \
+        || defined(_GLIBCXX_PROFILE)
+#      define BOOST_DETAIL_NO_CONTAINER_FWD
+#    else
+#      if defined(__GLIBCXX__) && __GLIBCXX__ >= 20040530
+#        define BOOST_CONTAINER_FWD_COMPLEX_STRUCT
+#      endif
+#    endif
+#  elif defined(__STL_CONFIG_H)
+     // generic SGI STL
+     //
+     // Forward declaration seems to be okay, but it has a couple of odd
+     // implementations.
+#    define BOOST_CONTAINER_FWD_BAD_BITSET
+#    if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
+#      define BOOST_CONTAINER_FWD_BAD_DEQUE
+#     endif
+#  elif defined(__MSL_CPP__)
+     // MSL standard lib:
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif defined(__IBMCPP__)
+     // The default VACPP std lib, forward declaration seems to be fine.
+#  elif defined(MSIPL_COMPILE_H)
+     // Modena C++ standard library
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+     // Dinkumware Library (this has to appear after any possible replacement
+     // libraries)
+#  else
+#    define BOOST_DETAIL_NO_CONTAINER_FWD
+#  endif
+#endif
+
+#if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
+
+#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \
+    !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD)
+
+#include <deque>
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+#include <bitset>
+#include <string>
+#include <complex>
+
+#else
+
+#include <cstddef>
+
+#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
+#include <deque>
+#endif
+
+#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
+#include <bitset>
+#endif
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
+#endif
+
+namespace std
+{
+    template <class T> class allocator;
+    template <class charT, class traits, class Allocator> class basic_string;
+
+    template <class charT> struct char_traits;
+
+#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT)
+    template <class T> struct complex;
+#else
+    template <class T> class complex;
+#endif
+
+#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
+    template <class T, class Allocator> class deque;
+#endif
+
+    template <class T, class Allocator> class list;
+    template <class T, class Allocator> class vector;
+    template <class Key, class T, class Compare, class Allocator> class map;
+    template <class Key, class T, class Compare, class Allocator>
+    class multimap;
+    template <class Key, class Compare, class Allocator> class set;
+    template <class Key, class Compare, class Allocator> class multiset;
+
+#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
+    template <size_t N> class bitset;
+#endif
+    template <class T1, class T2> struct pair;
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_DETAIL_NO_CONTAINER_FWD &&
+       // !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD)
+
+#endif // BOOST_DETAIL_TEST_CONFIG_ONLY
+
+#endif
diff --git a/include/boost/detail/fenv.hpp b/include/boost/detail/fenv.hpp
new file mode 100644
index 0000000..b268f5c
--- /dev/null
+++ b/include/boost/detail/fenv.hpp
@@ -0,0 +1,101 @@
+/*=============================================================================
+    Copyright (c) 2010      Bryce Lelbach
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_FENV_H)
+  #error This platform does not have a floating point environment
+#endif
+
+#if !defined(BOOST_DETAIL_FENV_HPP)
+#define BOOST_DETAIL_FENV_HPP
+
+/* If we're using clang + glibc, we have to get hacky.
+ * See http://llvm.org/bugs/show_bug.cgi?id=6907 */
+#if defined(__clang__)       &&  (__clang_major__ < 3) &&    \
+    defined(__GNU_LIBRARY__) && /* up to version 5 */ \
+    defined(__GLIBC__) &&         /* version 6 + */ \
+    !defined(_FENV_H)
+  #define _FENV_H
+
+  #include <features.h>
+  #include <bits/fenv.h>
+
+  extern "C" {
+    extern int fegetexceptflag (fexcept_t*, int) __THROW;
+    extern int fesetexceptflag (__const fexcept_t*, int) __THROW;
+    extern int feclearexcept (int) __THROW;
+    extern int feraiseexcept (int) __THROW;
+    extern int fetestexcept (int) __THROW;
+    extern int fegetround (void) __THROW;
+    extern int fesetround (int) __THROW;
+    extern int fegetenv (fenv_t*) __THROW;
+    extern int fesetenv (__const fenv_t*) __THROW;
+    extern int feupdateenv (__const fenv_t*) __THROW;
+    extern int feholdexcept (fenv_t*) __THROW;
+
+    #ifdef __USE_GNU
+      extern int feenableexcept (int) __THROW;
+      extern int fedisableexcept (int) __THROW;
+      extern int fegetexcept (void) __THROW;
+    #endif
+  }
+
+  namespace std { namespace tr1 {
+    using ::fenv_t;
+    using ::fexcept_t;
+    using ::fegetexceptflag;
+    using ::fesetexceptflag;
+    using ::feclearexcept;
+    using ::feraiseexcept;
+    using ::fetestexcept;
+    using ::fegetround;
+    using ::fesetround;
+    using ::fegetenv;
+    using ::fesetenv;
+    using ::feupdateenv;
+    using ::feholdexcept;
+  } }
+
+#elif defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
+
+  // MinGW (32-bit) has a bug in mingw32/bits/c++config.h, it does not define _GLIBCXX_HAVE_FENV_H,
+  // which prevents the C fenv.h header contents to be included in the C++ wrapper header fenv.h. This is at least
+  // the case with gcc 4.8.1 packages tested so far, up to 4.8.1-4. Note that there is no issue with
+  // MinGW-w64.
+  // To work around the bug we avoid including the C++ wrapper header and include the C header directly
+  // and import all relevant symbols into std:: ourselves.
+
+  #include <../include/fenv.h>
+
+  namespace std {
+    using ::fenv_t;
+    using ::fexcept_t;
+    using ::fegetexceptflag;
+    using ::fesetexceptflag;
+    using ::feclearexcept;
+    using ::feraiseexcept;
+    using ::fetestexcept;
+    using ::fegetround;
+    using ::fesetround;
+    using ::fegetenv;
+    using ::fesetenv;
+    using ::feupdateenv;
+    using ::feholdexcept;
+  }
+
+#else /* if we're not using GNU's C stdlib, fenv.h should work with clang */
+
+  #if defined(__SUNPRO_CC) /* lol suncc */
+    #include <stdio.h>
+  #endif
+
+  #include <fenv.h>
+
+#endif
+
+#endif /* BOOST_DETAIL_FENV_HPP */
diff --git a/include/boost/detail/has_default_constructor.hpp b/include/boost/detail/has_default_constructor.hpp
new file mode 100644
index 0000000..319b30a
--- /dev/null
+++ b/include/boost/detail/has_default_constructor.hpp
@@ -0,0 +1,29 @@
+
+//  (C) Copyright Matthias Troyerk 2006.
+//  Use, modification and distribution are subject to the Boost Software License,
+//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt).
+//
+//  See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
+#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
+
+#include <boost/type_traits/has_trivial_constructor.hpp>
+
+namespace boost { namespace detail {
+
+/// type trait to check for a default constructor
+///
+/// The default implementation just checks for a trivial constructor.
+/// Using some compiler magic it might be possible to provide a better default
+
+template <class T>
+struct has_default_constructor
+ : public has_trivial_constructor<T>
+{};
+
+} } // namespace boost::detail
+
+
+#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
diff --git a/include/boost/detail/identifier.hpp b/include/boost/detail/identifier.hpp
new file mode 100644
index 0000000..063d238
--- /dev/null
+++ b/include/boost/detail/identifier.hpp
@@ -0,0 +1,87 @@
+//  boost/identifier.hpp  ----------------------------------------------------//
+
+//  Copyright Beman Dawes 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 documentation at http://www.boost.org/libs/utility
+
+#ifndef BOOST_IDENTIFIER_HPP
+#define BOOST_IDENTIFIER_HPP
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <iosfwd>
+
+namespace boost
+{
+  namespace detail
+  {
+    //  class template identifier  ---------------------------------------------//
+
+    //  Always used as a base class so that different instantiations result in
+    //  different class types even if instantiated with the same value type T.
+
+    //  Expected usage is that T is often an integer type, best passed by
+    //  value. There is no reason why T can't be a possibly larger class such as
+    //  std::string, best passed by const reference.
+
+    //  This implementation uses pass by value, based on expected common uses.
+
+    template <typename T, typename D>
+    class identifier
+    {
+    public:
+      typedef T value_type;
+
+      const value_type value() const           { return m_value; }
+      void  assign( value_type v )             { m_value = v; }
+
+      bool operator==( const D & rhs ) const   { return m_value == rhs.m_value; }
+      bool operator!=( const D & rhs ) const   { return m_value != rhs.m_value; }
+      bool operator< ( const D & rhs ) const   { return m_value <  rhs.m_value; }
+      bool operator<=( const D & rhs ) const   { return m_value <= rhs.m_value; }
+      bool operator> ( const D & rhs ) const   { return m_value >  rhs.m_value; }
+      bool operator>=( const D & rhs ) const   { return m_value >= rhs.m_value; }
+
+      typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type 
+      static void unspecified_bool_true(D){}    // conversion allows relational operators
+                                                // between different identifier types
+
+      operator unspecified_bool_type() const   { return m_value == value_type() ? 0 : unspecified_bool_true; }
+      bool operator!() const                   { return m_value == value_type(); }
+
+    // constructors are protected so that class can only be used as a base class
+    protected:
+      identifier()                             {}
+      explicit identifier( value_type v )      : m_value(v) {}
+
+    private:
+      T m_value;
+    };
+
+  //#ifndef BOOST_NO_SFINAE
+
+  //  template <class Ostream, class Id>
+  //    typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, 
+  //      Ostream & >::type operator<<( Ostream & os, const Id & id )
+  //  {
+  //    return os << id.value();
+  //  }
+
+  //  template <class Istream, class Id>
+  //    typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, 
+  //      Istream & >::type operator>>( Istream & is, Id & id )
+  //  {
+  //    typename Id::value_type v;
+  //    is >> v;
+  //    id.value( v );
+  //    return is;
+  //  }
+  //#endif
+
+  } // namespace detail
+} // namespace boost
+
+#endif // BOOST_IDENTIFIER_HPP
diff --git a/include/boost/detail/indirect_traits.hpp b/include/boost/detail/indirect_traits.hpp
new file mode 100644
index 0000000..6294e40
--- /dev/null
+++ b/include/boost/detail/indirect_traits.hpp
@@ -0,0 +1,204 @@
+// Copyright David Abrahams 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef INDIRECT_TRAITS_DWA2002131_HPP
+# define INDIRECT_TRAITS_DWA2002131_HPP
+# include <boost/type_traits/is_function.hpp>
+# include <boost/type_traits/is_reference.hpp>
+# include <boost/type_traits/is_pointer.hpp>
+# include <boost/type_traits/is_class.hpp>
+# include <boost/type_traits/is_const.hpp>
+# include <boost/type_traits/is_volatile.hpp>
+# include <boost/type_traits/is_member_function_pointer.hpp>
+# include <boost/type_traits/is_member_pointer.hpp>
+# include <boost/type_traits/remove_cv.hpp>
+# include <boost/type_traits/remove_reference.hpp>
+# include <boost/type_traits/remove_pointer.hpp>
+
+# include <boost/detail/workaround.hpp>
+
+# include <boost/mpl/eval_if.hpp>
+# include <boost/mpl/if.hpp>
+# include <boost/mpl/bool.hpp>
+# include <boost/mpl/and.hpp>
+# include <boost/mpl/not.hpp>
+# include <boost/mpl/aux_/lambda_support.hpp>
+
+
+namespace boost { namespace detail {
+
+namespace indirect_traits {
+
+template <class T>
+struct is_reference_to_const : mpl::false_
+{
+};
+
+template <class T>
+struct is_reference_to_const<T const&> : mpl::true_
+{
+};
+
+#   if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
+template<class T>
+struct is_reference_to_const<T const volatile&> : mpl::true_
+{
+};
+#   endif 
+
+template <class T>
+struct is_reference_to_function : mpl::false_
+{
+};
+
+template <class T>
+struct is_reference_to_function<T&> : is_function<T>
+{
+};
+
+template <class T>
+struct is_pointer_to_function : mpl::false_
+{
+};
+
+// There's no such thing as a pointer-to-cv-function, so we don't need
+// specializations for those
+template <class T>
+struct is_pointer_to_function<T*> : is_function<T>
+{
+};
+
+template <class T>
+struct is_reference_to_member_function_pointer_impl : mpl::false_
+{
+};
+
+template <class T>
+struct is_reference_to_member_function_pointer_impl<T&>
+    : is_member_function_pointer<typename remove_cv<T>::type>
+{
+};
+
+
+template <class T>
+struct is_reference_to_member_function_pointer
+    : is_reference_to_member_function_pointer_impl<T>
+{
+    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
+};
+
+template <class T>
+struct is_reference_to_function_pointer_aux
+    : mpl::and_<
+          is_reference<T>
+        , is_pointer_to_function<
+              typename remove_cv<
+                  typename remove_reference<T>::type
+              >::type
+          >
+      >
+{
+    // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
+};
+
+template <class T>
+struct is_reference_to_function_pointer
+    : mpl::if_<
+          is_reference_to_function<T>
+        , mpl::false_
+        , is_reference_to_function_pointer_aux<T>
+     >::type
+{
+};
+
+template <class T>
+struct is_reference_to_non_const
+    : mpl::and_<
+          is_reference<T>
+        , mpl::not_<
+             is_reference_to_const<T>
+          >
+      >
+{
+};
+
+template <class T>
+struct is_reference_to_volatile : mpl::false_
+{
+};
+
+template <class T>
+struct is_reference_to_volatile<T volatile&> : mpl::true_
+{
+};
+
+#   if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
+template <class T>
+struct is_reference_to_volatile<T const volatile&> : mpl::true_
+{
+};
+#   endif 
+
+
+template <class T>
+struct is_reference_to_pointer : mpl::false_
+{
+};
+
+template <class T>
+struct is_reference_to_pointer<T*&> : mpl::true_
+{
+};
+
+template <class T>
+struct is_reference_to_pointer<T* const&> : mpl::true_
+{
+};
+
+template <class T>
+struct is_reference_to_pointer<T* volatile&> : mpl::true_
+{
+};
+
+template <class T>
+struct is_reference_to_pointer<T* const volatile&> : mpl::true_
+{
+};
+
+template <class T>
+struct is_reference_to_class
+    : mpl::and_<
+          is_reference<T>
+        , is_class<
+              typename remove_cv<
+                  typename remove_reference<T>::type
+              >::type
+          >
+      >
+{
+    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
+};
+
+template <class T>
+struct is_pointer_to_class
+    : mpl::and_<
+          is_pointer<T>
+        , is_class<
+              typename remove_cv<
+                  typename remove_pointer<T>::type
+              >::type
+          >
+      >
+{
+    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
+};
+
+
+}
+
+using namespace indirect_traits;
+
+}} // namespace boost::python::detail
+
+#endif // INDIRECT_TRAITS_DWA2002131_HPP
diff --git a/include/boost/detail/is_incrementable.hpp b/include/boost/detail/is_incrementable.hpp
new file mode 100644
index 0000000..5ebf4b7
--- /dev/null
+++ b/include/boost/detail/is_incrementable.hpp
@@ -0,0 +1,125 @@
+// Copyright David Abrahams 2004. Use, modification and distribution is
+// subject to the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#ifndef IS_INCREMENTABLE_DWA200415_HPP
+# define IS_INCREMENTABLE_DWA200415_HPP
+
+# include <boost/type_traits/integral_constant.hpp>
+# include <boost/type_traits/remove_cv.hpp>
+# include <boost/mpl/aux_/lambda_support.hpp>
+# include <boost/mpl/bool.hpp>
+# include <boost/detail/workaround.hpp>
+
+namespace boost { namespace detail {
+
+// is_incrementable<T> metafunction
+//
+// Requires: Given x of type T&, if the expression ++x is well-formed
+// it must have complete type; otherwise, it must neither be ambiguous
+// nor violate access.
+
+// This namespace ensures that ADL doesn't mess things up.
+namespace is_incrementable_
+{
+  // a type returned from operator++ when no increment is found in the
+  // type's own namespace
+  struct tag {};
+
+  // any soaks up implicit conversions and makes the following
+  // operator++ less-preferred than any other such operator that
+  // might be found via ADL.
+  struct any { template <class T> any(T const&); };
+
+  // This is a last-resort operator++ for when none other is found
+# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
+
+}
+
+namespace is_incrementable_2
+{
+  is_incrementable_::tag operator++(is_incrementable_::any const&);
+  is_incrementable_::tag operator++(is_incrementable_::any const&,int);
+}
+using namespace is_incrementable_2;
+
+namespace is_incrementable_
+{
+
+# else
+
+  tag operator++(any const&);
+  tag operator++(any const&,int);
+
+# endif
+
+# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) 
+#  define BOOST_comma(a,b) (a)
+# else
+  // In case an operator++ is found that returns void, we'll use ++x,0
+  tag operator,(tag,int);
+#  define BOOST_comma(a,b) (a,b)
+# endif
+
+# if defined(BOOST_MSVC)
+#  pragma warning(push)
+#  pragma warning(disable:4913) // Warning about operator,
+# endif
+
+  // two check overloads help us identify which operator++ was picked
+  char (& check_(tag) )[2];
+
+  template <class T>
+  char check_(T const&);
+
+
+  template <class T>
+  struct impl
+  {
+      static typename boost::remove_cv<T>::type& x;
+
+      BOOST_STATIC_CONSTANT(
+          bool
+        , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
+      );
+  };
+
+  template <class T>
+  struct postfix_impl
+  {
+      static typename boost::remove_cv<T>::type& x;
+
+      BOOST_STATIC_CONSTANT(
+          bool
+        , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
+      );
+  };
+
+# if defined(BOOST_MSVC)
+#  pragma warning(pop)
+# endif
+
+}
+
+# undef BOOST_comma
+
+template<typename T>
+struct is_incrementable :
+    public boost::integral_constant<bool, boost::detail::is_incrementable_::impl<T>::value>
+{
+    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
+};
+
+template<typename T>
+struct is_postfix_incrementable :
+    public boost::integral_constant<bool, boost::detail::is_incrementable_::postfix_impl<T>::value>
+{
+    BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
+};
+
+} // namespace detail
+
+} // namespace boost
+
+# include <boost/type_traits/detail/bool_trait_undef.hpp>
+
+#endif // IS_INCREMENTABLE_DWA200415_HPP
diff --git a/include/boost/detail/is_sorted.hpp b/include/boost/detail/is_sorted.hpp
new file mode 100644
index 0000000..5ab32e5
--- /dev/null
+++ b/include/boost/detail/is_sorted.hpp
@@ -0,0 +1,56 @@
+/*==============================================================================
+    Copyright (c) 2010-2011 Bryce Lelbach
+
+    Distributed under the Boost Software License, Version 1.0. (See accompanying
+    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_DETAIL_SORTED_HPP
+#define BOOST_DETAIL_SORTED_HPP
+
+#include <boost/detail/iterator.hpp>
+
+#include <functional>
+
+namespace boost {
+namespace detail {
+
+template<class Iterator, class Comp>
+inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) {
+  if (first == last)
+    return last;
+
+  Iterator it = first; ++it;
+
+  for (; it != last; first = it, ++it)
+    if (c(*it, *first))
+      return it;
+
+  return it;
+}
+
+template<class Iterator>
+inline Iterator is_sorted_until (Iterator first, Iterator last) {
+  typedef typename boost::detail::iterator_traits<Iterator>::value_type
+    value_type;
+
+  typedef std::less<value_type> c; 
+
+  return ::boost::detail::is_sorted_until(first, last, c()); 
+}
+
+template<class Iterator, class Comp>
+inline bool is_sorted (Iterator first, Iterator last, Comp c) {
+  return ::boost::detail::is_sorted_until(first, last, c) == last;
+} 
+
+template<class Iterator>
+inline bool is_sorted (Iterator first, Iterator last) {
+  return ::boost::detail::is_sorted_until(first, last) == last;
+} 
+
+} // detail
+} // boost
+
+#endif // BOOST_DETAIL_SORTED_HPP
+
diff --git a/include/boost/detail/is_xxx.hpp b/include/boost/detail/is_xxx.hpp
new file mode 100644
index 0000000..3f9a126
--- /dev/null
+++ b/include/boost/detail/is_xxx.hpp
@@ -0,0 +1,27 @@
+// Copyright David Abrahams 2005. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP
+# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
+
+# include <boost/config.hpp>
+# include <boost/mpl/bool.hpp>
+# include <boost/preprocessor/enum_params.hpp>
+
+
+#  define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs)  \
+template <class T>                                              \
+struct is_##name : mpl::false_                                  \
+{                                                               \
+};                                                              \
+                                                                \
+template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) >          \
+struct is_##name<                                               \
+   qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) >        \
+>                                                               \
+   : mpl::true_                                                 \
+{                                                               \
+};
+
+
+#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP
diff --git a/include/boost/detail/lightweight_main.hpp b/include/boost/detail/lightweight_main.hpp
new file mode 100644
index 0000000..1705309
--- /dev/null
+++ b/include/boost/detail/lightweight_main.hpp
@@ -0,0 +1,36 @@
+//  boost/detail/lightweight_main.hpp  -------------------------------------------------//
+
+//  Copyright Beman Dawes 2010
+
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+#include <iostream>
+#include <exception>
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                exception reporting main() that calls cpp_main()                      //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+int cpp_main(int argc, char* argv[]);
+
+int main(int argc, char* argv[])
+{
+  try
+  {
+    return cpp_main(argc, argv);
+  }
+
+  catch (const std::exception& ex)
+  {
+    std::cout
+    << "\nERROR  ERROR  ERROR  ERROR  ERROR  ERROR  ERROR  ERROR  ERROR  ERROR  ERROR\n"
+    << "\n****************************** std::exception *****************************\n"
+    << ex.what()
+    << "\n***************************************************************************\n"
+    << std::endl;
+  }
+  return 1;
+}
diff --git a/include/boost/detail/lightweight_test_report.hpp b/include/boost/detail/lightweight_test_report.hpp
new file mode 100644
index 0000000..1511ba9
--- /dev/null
+++ b/include/boost/detail/lightweight_test_report.hpp
@@ -0,0 +1,56 @@
+//  boost/detail/lightweight_test_reporter.hpp  ----------------------------------------//
+
+//  Copyright Beman Dawes 2014
+
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+//--------------------------------------------------------------------------------------//
+//                                                                                      //
+//                         Configuration reporting cpp_main()                           //
+//                                                                                      //
+//  Displays configuration information, then returns test_main(argc, argv), which       //
+//  must be supplied by the user.                                                       //
+//                                                                                      //
+//  Note: cpp_main(argc, argv) is called from a try block in main(), which is           //
+//  supplied by <boost/detail/lightweight_main.hpp> as is a catch block that reports    //
+//  std::exception what().                                                              //
+//                                                                                      //
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include <iostream>
+
+int test_main(int argc, char* argv[]);
+
+int cpp_main(int argc, char* argv[])
+{
+  std::cout << BOOST_COMPILER
+#ifdef __GNUC__
+            << ", __GXX_EXPERIMENTAL_CXX0X__ "
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+              "defined"
+# else
+              "not defined"
+# endif
+#endif
+            << "\n"
+            << BOOST_STDLIB << "\n"
+            << BOOST_PLATFORM << "\n"
+            << "Boost version " << BOOST_VERSION / 100000 << '.'
+            << BOOST_VERSION / 100 % 1000 << '.' << BOOST_VERSION % 100 << "\n";
+
+  std::cout << "Command line: ";
+  for (int a = 0; a < argc; ++a)
+  {
+    std::cout << argv[a];
+    if (a != argc - 1)
+      std::cout << ' ';
+  }
+  std::cout << std::endl;
+
+  return test_main(argc, argv);
+}
\ No newline at end of file
diff --git a/include/boost/detail/named_template_params.hpp b/include/boost/detail/named_template_params.hpp
new file mode 100644
index 0000000..e7cb079
--- /dev/null
+++ b/include/boost/detail/named_template_params.hpp
@@ -0,0 +1,177 @@
+// (C) Copyright Jeremy Siek 2001.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History:
+
+// 04 Oct 2001   David Abrahams
+//      Changed name of "bind" to "select" to avoid problems with MSVC.
+
+#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
+#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
+
+#include <boost/type_traits/conversion_traits.hpp>
+#include <boost/type_traits/composite_traits.hpp> // for is_reference
+#if defined(__BORLANDC__)
+#include <boost/type_traits/ice.hpp>
+#endif
+
+namespace boost {
+  namespace detail {
+    
+    struct default_argument { };
+
+    struct dummy_default_gen {
+      template <class Base, class Traits>
+      struct select {
+        typedef default_argument type;
+      };
+    };
+
+   // This class template is a workaround for MSVC.
+   template <class Gen> struct default_generator {
+     typedef detail::dummy_default_gen type;
+   };
+
+    template <class T> struct is_default { 
+      enum { value = false };  
+      typedef type_traits::no_type type;
+    };
+    template <> struct is_default<default_argument> { 
+      enum { value = true }; 
+      typedef type_traits::yes_type type;
+    };
+
+    struct choose_default {
+      template <class Arg, class DefaultGen, class Base, class Traits>
+      struct select {
+        typedef typename default_generator<DefaultGen>::type Gen;
+        typedef typename Gen::template select<Base,Traits>::type type;
+      };
+    };
+    struct choose_arg {
+      template <class Arg, class DefaultGen, class Base, class Traits>
+      struct select {
+        typedef Arg type;
+      };
+    };
+
+#if defined(__BORLANDC__)
+    template <class UseDefault>
+    struct choose_arg_or_default { typedef choose_arg type; };
+    template <>
+    struct choose_arg_or_default<type_traits::yes_type> {
+      typedef choose_default type;
+    };
+#else
+    template <bool UseDefault>
+    struct choose_arg_or_default { typedef choose_arg type; };
+    template <>
+    struct choose_arg_or_default<true> {
+      typedef choose_default type;
+    };
+#endif
+    
+    template <class Arg, class DefaultGen, class Base, class Traits>
+    class resolve_default {
+#if defined(__BORLANDC__)
+      typedef typename choose_arg_or_default<typename is_default<Arg>::type>::type Selector;
+#else
+      // This usually works for Borland, but I'm seeing weird errors in
+      // iterator_adaptor_test.cpp when using this method.
+      enum { is_def = is_default<Arg>::value };
+      typedef typename choose_arg_or_default<is_def>::type Selector;
+#endif
+    public:
+      typedef typename Selector
+        ::template select<Arg, DefaultGen, Base, Traits>::type type;
+    };
+
+    // To differentiate an unnamed parameter from a traits generator
+    // we use is_convertible<X, iter_traits_gen_base>.
+    struct named_template_param_base { };
+
+    template <class X>
+    struct is_named_param_list {
+      enum { value  = is_convertible<X, named_template_param_base>::value };
+    };
+    
+    struct choose_named_params {
+      template <class Prev> struct select { typedef Prev type; };
+    };
+    struct choose_default_arg {
+      template <class Prev> struct select { 
+        typedef detail::default_argument type;
+      };
+    };
+
+    template <bool Named> struct choose_default_dispatch_;
+    template <> struct choose_default_dispatch_<true> {
+      typedef choose_named_params type;
+    };
+    template <> struct choose_default_dispatch_<false> {
+      typedef choose_default_arg type;
+    };
+    // The use of inheritance here is a Solaris Forte 6 workaround.
+    template <bool Named> struct choose_default_dispatch
+      : public choose_default_dispatch_<Named> { };
+
+    template <class PreviousArg>
+    struct choose_default_argument {
+      enum { is_named = is_named_param_list<PreviousArg>::value };
+      typedef typename choose_default_dispatch<is_named>::type Selector;
+      typedef typename Selector::template select<PreviousArg>::type type;
+    };
+
+    // This macro assumes that there is a class named default_##TYPE
+    // defined before the application of the macro.  This class should
+    // have a single member class template named "select" with two
+    // template parameters: the type of the class being created (e.g.,
+    // the iterator_adaptor type when creating iterator adaptors) and
+    // a traits class. The select class should have a single typedef
+    // named "type" that produces the default for TYPE.  See
+    // boost/iterator_adaptors.hpp for an example usage.  Also,
+    // applications of this macro must be placed in namespace
+    // boost::detail.
+
+#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
+    struct get_##TYPE##_from_named { \
+      template <class Base, class NamedParams, class Traits> \
+      struct select { \
+          typedef typename NamedParams::traits NamedTraits; \
+          typedef typename NamedTraits::TYPE TYPE; \
+          typedef typename resolve_default<TYPE, \
+            default_##TYPE, Base, NamedTraits>::type type; \
+      }; \
+    }; \
+    struct pass_thru_##TYPE { \
+      template <class Base, class Arg, class Traits> struct select { \
+          typedef typename resolve_default<Arg, \
+            default_##TYPE, Base, Traits>::type type; \
+      };\
+    }; \
+    template <int NamedParam> \
+    struct get_##TYPE##_dispatch { }; \
+    template <> struct get_##TYPE##_dispatch<1> { \
+      typedef get_##TYPE##_from_named type; \
+    }; \
+    template <> struct get_##TYPE##_dispatch<0> { \
+      typedef pass_thru_##TYPE type; \
+    }; \
+    template <class Base, class X, class Traits>  \
+    class get_##TYPE { \
+      enum { is_named = is_named_param_list<X>::value }; \
+      typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
+    public: \
+      typedef typename Selector::template select<Base, X, Traits>::type type; \
+    }; \
+    template <> struct default_generator<default_##TYPE> { \
+      typedef default_##TYPE type; \
+    }
+
+    
+  } // namespace detail
+} // namespace boost
+
+#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
diff --git a/include/boost/detail/numeric_traits.hpp b/include/boost/detail/numeric_traits.hpp
new file mode 100644
index 0000000..a62affb
--- /dev/null
+++ b/include/boost/detail/numeric_traits.hpp
@@ -0,0 +1,160 @@
+// (C) Copyright David Abrahams 2001, Howard Hinnant 2001.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Template class numeric_traits<Number> --
+//
+//    Supplies:
+//
+//      typedef difference_type -- a type used to represent the difference
+//      between any two values of Number.
+//
+//    Support:
+//      1. Not all specializations are supplied
+//
+//      2. Use of specializations that are not supplied will cause a
+//      compile-time error
+//
+//      3. Users are free to specialize numeric_traits for any type.
+//
+//      4. Right now, specializations are only supplied for integer types.
+//
+//      5. On implementations which do not supply compile-time constants in
+//      std::numeric_limits<>, only specializations for built-in integer types
+//      are supplied.
+//
+//      6. Handling of numbers whose range of representation is at least as
+//      great as boost::intmax_t can cause some differences to be
+//      unrepresentable in difference_type:
+//
+//        Number    difference_type
+//        ------    ---------------
+//        signed    Number
+//        unsigned  intmax_t
+//
+// template <class Number> typename numeric_traits<Number>::difference_type
+// numeric_distance(Number x, Number y)
+//    computes (y - x), attempting to avoid overflows.
+//
+
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams)
+// 11 Feb 2001 - Rolled back ineffective Borland-specific code
+//               (David Abrahams)
+// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but
+//               not seeing any improvement yet (David Abrahams)
+// 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp
+//               (David Abrahams)
+// 23 Jan 2001 - Fixed logic of difference_type selection, which was
+//               completely wack. In the process, added digit_traits<>
+//               to compute the number of digits in intmax_t even when
+//               not supplied by numeric_limits<>. (David Abrahams)
+// 21 Jan 2001 - Created (David Abrahams)
+
+#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901
+#define BOOST_NUMERIC_TRAITS_HPP_DWA20001901
+
+#include <cstddef>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/type_traits/is_signed.hpp>
+#include <boost/type_traits/conditional.hpp>
+#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#endif
+
+namespace boost { namespace detail {
+
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+  // digit_traits - compute the number of digits in a built-in integer
+  // type. Needed for implementations on which numeric_limits is not specialized
+  // for some integer types, like __int128 in libstdc++ (gcc).
+  template <class T, bool IsSpecialized = std::numeric_limits<T>::is_specialized>
+  struct digit_traits
+  {
+      BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits<T>::digits);
+  };
+
+  // numeric_limits is not specialized; compute digits from sizeof(T)
+  template <class T>
+  struct digit_traits<T, false>
+  {
+      BOOST_STATIC_CONSTANT(int, digits = (
+          sizeof(T) * std::numeric_limits<unsigned char>::digits
+          - (boost::is_signed<T>::value ? 1 : 0))
+          );
+  };
+#endif
+
+  // Template class integer_traits<Integer> -- traits of various integer types
+  // This should probably be rolled into boost::integer_traits one day, but I
+  // need it to work without <limits>
+  template <class Integer>
+  struct integer_traits
+  {
+#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+   private:
+      typedef Integer integer_type;
+      typedef std::numeric_limits<integer_type> x;
+   public:
+      typedef typename boost::conditional<
+        (int(x::is_signed)
+          && (!int(x::is_bounded)
+             // digits is the number of no-sign bits
+             || (int(x::digits) + 1 >= digit_traits<boost::intmax_t>::digits))),
+        Integer,
+
+        typename boost::conditional<
+          (int(x::digits) + 1 < digit_traits<signed int>::digits),
+          signed int,
+
+          typename boost::conditional<
+            (int(x::digits) + 1 < digit_traits<signed long>::digits),
+            signed long,
+            boost::intmax_t
+          >::type
+        >::type
+      >::type difference_type;
+#else
+      BOOST_STATIC_ASSERT(boost::is_integral<Integer>::value);
+
+      typedef typename boost::conditional<
+        (sizeof(Integer) >= sizeof(intmax_t)),
+
+        boost::conditional<
+          (boost::is_signed<Integer>::value),
+          Integer,
+          boost::intmax_t
+        >,
+
+        boost::conditional<
+          (sizeof(Integer) < sizeof(std::ptrdiff_t)),
+          std::ptrdiff_t,
+          boost::intmax_t
+        >
+      >::type::type difference_type;
+#endif
+  };
+
+  // Right now, only supports integers, but should be expanded.
+  template <class Number>
+  struct numeric_traits
+  {
+      typedef typename integer_traits<Number>::difference_type difference_type;
+  };
+
+  template <class Number>
+  inline BOOST_CONSTEXPR typename numeric_traits<Number>::difference_type numeric_distance(Number x, Number y)
+  {
+      typedef typename numeric_traits<Number>::difference_type difference_type;
+      return difference_type(y) - difference_type(x);
+  }
+}}
+
+#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901
diff --git a/include/boost/detail/reference_content.hpp b/include/boost/detail/reference_content.hpp
new file mode 100644
index 0000000..36b80d2
--- /dev/null
+++ b/include/boost/detail/reference_content.hpp
@@ -0,0 +1,120 @@
+//-----------------------------------------------------------------------------
+// boost detail/reference_content.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2003
+// Eric Friedman
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
+#define BOOST_DETAIL_REFERENCE_CONTENT_HPP
+
+#include "boost/config.hpp"
+
+#   include "boost/mpl/bool.hpp"
+#   include "boost/type_traits/has_nothrow_copy.hpp"
+
+#include "boost/mpl/void.hpp"
+
+namespace boost {
+
+namespace detail {
+
+///////////////////////////////////////////////////////////////////////////////
+// (detail) class template reference_content
+//
+// Non-Assignable wrapper for references.
+//
+template <typename RefT>
+class reference_content
+{
+private: // representation
+
+    RefT content_;
+
+public: // structors
+
+    ~reference_content()
+    {
+    }
+
+    reference_content(RefT r)
+        : content_( r )
+    {
+    }
+
+    reference_content(const reference_content& operand)
+        : content_( operand.content_ )
+    {
+    }
+
+private: // non-Assignable
+
+    reference_content& operator=(const reference_content&);
+
+public: // queries
+
+    RefT get() const
+    {
+        return content_;
+    }
+
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// (detail) metafunction make_reference_content
+//
+// Wraps with reference_content if specified type is reference.
+//
+
+template <typename T = mpl::void_> struct make_reference_content;
+
+
+template <typename T>
+struct make_reference_content
+{
+    typedef T type;
+};
+
+template <typename T>
+struct make_reference_content< T& >
+{
+    typedef reference_content<T&> type;
+};
+
+
+template <>
+struct make_reference_content< mpl::void_ >
+{
+    template <typename T>
+    struct apply
+        : make_reference_content<T>
+    {
+    };
+
+    typedef mpl::void_ type;
+};
+
+} // namespace detail
+
+///////////////////////////////////////////////////////////////////////////////
+// reference_content<T&> type traits specializations
+//
+
+
+template <typename T>
+struct has_nothrow_copy<
+      ::boost::detail::reference_content< T& >
+    >
+    : mpl::true_
+{
+};
+
+
+} // namespace boost
+
+#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP
diff --git a/include/boost/detail/select_type.hpp b/include/boost/detail/select_type.hpp
new file mode 100644
index 0000000..c13946f
--- /dev/null
+++ b/include/boost/detail/select_type.hpp
@@ -0,0 +1,36 @@
+// (C) Copyright David Abrahams 2001.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 09 Feb 01  Applied John Maddock's Borland patch Moving <true>
+//            specialization to unspecialized template (David Abrahams)
+// 06 Feb 01  Created (David Abrahams)
+
+#ifndef SELECT_TYPE_DWA20010206_HPP
+# define SELECT_TYPE_DWA20010206_HPP
+
+namespace boost { namespace detail {
+
+  // Template class if_true -- select among 2 types based on a bool constant expression
+  // Usage:
+  //   typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
+
+  // HP aCC cannot deal with missing names for template value parameters
+  template <bool b> struct if_true
+  {
+      template <class T, class F>
+      struct then { typedef T type; };
+  };
+
+  template <>
+  struct if_true<false>
+  {
+      template <class T, class F>
+      struct then { typedef F type; };
+  };
+}}
+#endif // SELECT_TYPE_DWA20010206_HPP
diff --git a/include/boost/detail/templated_streams.hpp b/include/boost/detail/templated_streams.hpp
new file mode 100644
index 0000000..1fa6ee3
--- /dev/null
+++ b/include/boost/detail/templated_streams.hpp
@@ -0,0 +1,74 @@
+//-----------------------------------------------------------------------------
+// boost detail/templated_streams.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2003
+// Eric Friedman
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP
+#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP
+
+#include "boost/config.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// (detail) BOOST_TEMPLATED_STREAM_* macros
+//
+// Provides workaround platforms without stream class templates.
+//
+
+#if !defined(BOOST_NO_STD_LOCALE)
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \
+    template < typename E , typename T >
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \
+    template < typename E , typename T , typename A >
+
+#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \
+    typename E , typename T 
+
+#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \
+    typename E , typename T , typename A 
+
+#define BOOST_TEMPLATED_STREAM_COMMA        ,
+
+#define BOOST_TEMPLATED_STREAM_ELEM(E)      E
+#define BOOST_TEMPLATED_STREAM_TRAITS(T)    T
+#define BOOST_TEMPLATED_STREAM_ALLOC(A)     A
+
+#define BOOST_TEMPLATED_STREAM(X,E,T) \
+    BOOST_JOIN(std::basic_,X)< E , T >
+
+#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
+    BOOST_JOIN(std::basic_,X)< E , T , A >
+
+#else // defined(BOOST_NO_STD_LOCALE)
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/
+
+#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/
+
+#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/
+
+#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/
+
+#define BOOST_TEMPLATED_STREAM_COMMA        /**/
+
+#define BOOST_TEMPLATED_STREAM_ELEM(E)      char
+#define BOOST_TEMPLATED_STREAM_TRAITS(T)    std::char_traits<char>
+#define BOOST_TEMPLATED_STREAM_ALLOC(A)     std::allocator<char>
+
+#define BOOST_TEMPLATED_STREAM(X,E,T) \
+    std::X
+
+#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
+    std::X
+
+#endif // BOOST_NO_STD_LOCALE
+
+#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP
diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp
new file mode 100644
index 0000000..12ae19b
--- /dev/null
+++ b/include/boost/detail/utf8_codecvt_facet.hpp
@@ -0,0 +1,219 @@
+// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
+// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
+// Distributed under the Boost Software License, Version 1.0. (See accompany-
+// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UTF8_CODECVT_FACET_HPP
+#define BOOST_UTF8_CODECVT_FACET_HPP
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// utf8_codecvt_facet.hpp
+
+// This header defines class utf8_codecvt_facet, derived from 
+// std::codecvt<wchar_t, char>, which can be used to convert utf8 data in
+// files into wchar_t strings in the application.
+//
+// The header is NOT STANDALONE, and is not to be included by the USER.
+// There are at least two libraries which want to use this functionality, and
+// we want to avoid code duplication. It would be possible to create utf8
+// library, but:
+// - this requires review process first
+// - in the case, when linking the a library which uses utf8 
+//   (say 'program_options'), user should also link to the utf8 library.
+//   This seems inconvenient, and asking a user to link to an unrevieved 
+//   library is strange. 
+// Until the above points are fixed, a library which wants to use utf8 must:
+// - include this header in one of it's headers or sources
+// - include the corresponding boost/detail/utf8_codecvt_facet.ipp file in one
+//   of its sources
+// - before including either file, the library must define
+//   - BOOST_UTF8_BEGIN_NAMESPACE to the namespace declaration that must be used
+//   - BOOST_UTF8_END_NAMESPACE to the code to close the previous namespace
+//     declaration.
+//   - BOOST_UTF8_DECL -- to the code which must be used for all 'exportable'
+//     symbols.
+//
+// For example, program_options library might contain:
+//    #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character> 
+//             namespace boost { namespace program_options {
+//    #define BOOST_UTF8_END_NAMESPACE }}
+//    #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL
+//    #include <boost/detail/utf8_codecvt_facet.ipp>
+//
+// Essentially, each library will have its own copy of utf8 code, in
+// different namespaces. 
+
+// Note:(Robert Ramey).  I have made the following alterations in the original
+// code.
+// a) Rendered utf8_codecvt<wchar_t, char>  with using templates
+// b) Move longer functions outside class definition to prevent inlining
+// and make code smaller
+// c) added on a derived class to permit translation to/from current
+// locale to utf8
+
+//  See http://www.boost.org for updates, documentation, and revision history.
+
+// archives stored as text - note these ar templated on the basic
+// stream templates to accommodate wide (and other?) kind of characters
+//
+// note the fact that on libraries without wide characters, ostream is
+// is not a specialization of basic_ostream which in fact is not defined
+// in such cases.   So we can't use basic_ostream<OStream::char_type> but rather
+// use two template parameters
+//
+// utf8_codecvt_facet
+//   This is an implementation of a std::codecvt facet for translating 
+//   from UTF-8 externally to UCS-4.  Note that this is not tied to
+//   any specific types in order to allow customization on platforms
+//   where wchar_t is not big enough.
+//
+// NOTES:  The current implementation jumps through some unpleasant hoops in
+// order to deal with signed character types.  As a std::codecvt_base::result,
+// it is necessary  for the ExternType to be convertible to unsigned  char.
+// I chose not to tie the extern_type explicitly to char. But if any combination
+// of types other than <wchar_t,char_t> is used, then std::codecvt must be
+// specialized on those types for this to work.
+
+#include <locale>
+#include <cwchar>   // for mbstate_t
+#include <cstddef>  // for std::size_t
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std {
+    using ::mbstate_t;
+    using ::size_t;
+}
+#endif
+
+// maximum lenght of a multibyte string
+#define MB_LENGTH_MAX 8
+
+BOOST_UTF8_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------------//
+//                                                                            //
+//                          utf8_codecvt_facet                                //
+//                                                                            //
+//            See utf8_codecvt_facet.ipp for the implementation.              //
+//----------------------------------------------------------------------------//
+
+#ifndef BOOST_UTF8_DECL
+#define BOOST_UTF8_DECL
+#endif
+
+struct BOOST_UTF8_DECL utf8_codecvt_facet :
+    public std::codecvt<wchar_t, char, std::mbstate_t>  
+{
+public:
+    explicit utf8_codecvt_facet(std::size_t no_locale_manage=0);
+    virtual ~utf8_codecvt_facet(){}
+protected:
+    virtual std::codecvt_base::result do_in(
+        std::mbstate_t& state, 
+        const char * from,
+        const char * from_end, 
+        const char * & from_next,
+        wchar_t * to, 
+        wchar_t * to_end, 
+        wchar_t*& to_next
+    ) const;
+
+    virtual std::codecvt_base::result do_out(
+        std::mbstate_t & state,
+        const wchar_t * from,
+        const wchar_t * from_end,
+        const wchar_t*  & from_next,
+        char * to,
+        char * to_end,
+        char * & to_next
+    ) const;
+
+    bool invalid_continuing_octet(unsigned char octet_1) const {
+        return (octet_1 < 0x80|| 0xbf< octet_1);
+    }
+
+    bool invalid_leading_octet(unsigned char octet_1)   const {
+        return (0x7f < octet_1 && octet_1 < 0xc0) ||
+            (octet_1 > 0xfd);
+    }
+
+    // continuing octets = octets except for the leading octet
+    static unsigned int get_cont_octet_count(unsigned char lead_octet) {
+        return get_octet_count(lead_octet) - 1;
+    }
+
+    static unsigned int get_octet_count(unsigned char lead_octet);
+
+    // How many "continuing octets" will be needed for this word
+    // ==   total octets - 1.
+    int get_cont_octet_out_count(wchar_t word) const ;
+
+    virtual bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW {
+        return false;
+    }
+
+    // UTF-8 isn't really stateful since we rewind on partial conversions
+    virtual std::codecvt_base::result do_unshift(
+        std::mbstate_t&,
+        char * from,
+        char * /*to*/,
+        char * & next
+    ) const {
+        next = from;
+        return ok;
+    }
+
+    virtual int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW {
+        const int variable_byte_external_encoding=0;
+        return variable_byte_external_encoding;
+    }
+
+    // How many char objects can I process to get <= max_limit
+    // wchar_t objects?
+    virtual int do_length(
+        std::mbstate_t &,
+        const char * from,
+        const char * from_end, 
+        std::size_t max_limit
+    ) const
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+    throw()
+#endif
+    ;
+
+    // Nonstandard override
+    virtual int do_length(
+        const std::mbstate_t & s,
+        const char * from,
+        const char * from_end, 
+        std::size_t max_limit
+    ) const
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+    throw()
+#endif
+    {
+        return do_length(
+            const_cast<std::mbstate_t &>(s),
+            from,
+            from_end,
+            max_limit
+        );
+    }
+
+    // Largest possible value do_length(state,from,from_end,1) could return.
+    virtual int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW {
+        return 6; // largest UTF-8 encoding of a UCS-4 character
+    }
+};
+
+BOOST_UTF8_END_NAMESPACE
+
+#endif // BOOST_UTF8_CODECVT_FACET_HPP
diff --git a/include/boost/detail/utf8_codecvt_facet.ipp b/include/boost/detail/utf8_codecvt_facet.ipp
new file mode 100644
index 0000000..d60f906
--- /dev/null
+++ b/include/boost/detail/utf8_codecvt_facet.ipp
@@ -0,0 +1,289 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// utf8_codecvt_facet.ipp
+
+// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
+// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). 
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Please see the comments in <boost/detail/utf8_codecvt_facet.hpp> to
+// learn how this file should be used.
+
+#include <boost/detail/utf8_codecvt_facet.hpp>
+
+#include <cstdlib> // for multi-byte converson routines
+#include <cassert>
+
+#include <boost/limits.hpp>
+#include <boost/config.hpp>
+
+// If we don't have wstring, then Unicode support 
+// is not available anyway, so we don't need to even
+// compiler this file. This also fixes the problem
+// with mingw, which can compile this file, but will
+// generate link error when building DLL.
+#ifndef BOOST_NO_STD_WSTRING
+
+BOOST_UTF8_BEGIN_NAMESPACE
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// implementation for wchar_t
+
+utf8_codecvt_facet::utf8_codecvt_facet(
+    std::size_t no_locale_manage
+) :
+    std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
+{}
+
+// Translate incoming UTF-8 into UCS-4
+std::codecvt_base::result utf8_codecvt_facet::do_in(
+    std::mbstate_t& /*state*/, 
+    const char * from,
+    const char * from_end, 
+    const char * & from_next,
+    wchar_t * to, 
+    wchar_t * to_end, 
+    wchar_t * & to_next
+) const {
+    // Basic algorithm:  The first octet determines how many
+    // octets total make up the UCS-4 character.  The remaining
+    // "continuing octets" all begin with "10". To convert, subtract
+    // the amount that specifies the number of octets from the first
+    // octet.  Subtract 0x80 (1000 0000) from each continuing octet,
+    // then mash the whole lot together.  Note that each continuing
+    // octet only uses 6 bits as unique values, so only shift by
+    // multiples of 6 to combine.
+    while (from != from_end && to != to_end) {
+
+        // Error checking   on the first octet
+        if (invalid_leading_octet(*from)){
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        // The first octet is   adjusted by a value dependent upon 
+        // the number   of "continuing octets" encoding the character
+        const   int cont_octet_count = get_cont_octet_count(*from);
+        const   wchar_t octet1_modifier_table[] =   {
+            0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+        };
+
+        // The unsigned char conversion is necessary in case char is
+        // signed   (I learned this the hard way)
+        wchar_t ucs_result = 
+            (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count];
+
+        // Invariants   : 
+        //   1) At the start of the loop,   'i' continuing characters have been
+        //    processed 
+        //   2) *from   points to the next continuing character to be processed.
+        int i   = 0;
+        while(i != cont_octet_count && from != from_end) {
+
+            // Error checking on continuing characters
+            if (invalid_continuing_octet(*from)) {
+                from_next   = from;
+                to_next =   to;
+                return std::codecvt_base::error;
+            }
+
+            ucs_result *= (1 << 6); 
+
+            // each continuing character has an extra (10xxxxxx)b attached to 
+            // it that must be removed.
+            ucs_result += (unsigned char)(*from++) - 0x80;
+            ++i;
+        }
+
+        // If   the buffer ends with an incomplete unicode character...
+        if (from == from_end && i   != cont_octet_count) {
+            // rewind "from" to before the current character translation
+            from_next = from - (i+1); 
+            to_next = to;
+            return std::codecvt_base::partial;
+        }
+        *to++   = ucs_result;
+    }
+    from_next = from;
+    to_next = to;
+
+    // Were we done converting or did we run out of destination space?
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+std::codecvt_base::result utf8_codecvt_facet::do_out(
+    std::mbstate_t& /*state*/, 
+    const wchar_t *   from,
+    const wchar_t * from_end, 
+    const wchar_t * & from_next,
+    char * to, 
+    char * to_end, 
+    char * & to_next
+) const
+{
+    // RG - consider merging this table with the other one
+    const wchar_t octet1_modifier_table[] = {
+        0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+    };
+
+    wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)();
+    while (from != from_end && to != to_end) {
+
+        // Check for invalid UCS-4 character
+        if (*from  > max_wchar) {
+            from_next = from;
+            to_next = to;
+            return std::codecvt_base::error;
+        }
+
+        int cont_octet_count = get_cont_octet_out_count(*from);
+
+        // RG  - comment this formula better
+        int shift_exponent = (cont_octet_count) *   6;
+
+        // Process the first character
+        *to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] +
+            (unsigned char)(*from / (1 << shift_exponent)));
+
+        // Process the continuation characters 
+        // Invariants: At   the start of the loop:
+        //   1) 'i' continuing octets   have been generated
+        //   2) '*to'   points to the next location to place an octet
+        //   3) shift_exponent is   6 more than needed for the next octet
+        int i   = 0;
+        while   (i != cont_octet_count && to != to_end) {
+            shift_exponent -= 6;
+            *to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6)));
+            ++i;
+        }
+        // If   we filled up the out buffer before encoding the character
+        if(to   == to_end && i != cont_octet_count) {
+            from_next = from;
+            to_next = to - (i+1);
+            return std::codecvt_base::partial;
+        }
+        ++from;
+    }
+    from_next = from;
+    to_next = to;
+    // Were we done or did we run out of destination space
+    if(from == from_end) return std::codecvt_base::ok;
+    else return std::codecvt_base::partial;
+}
+
+// How many char objects can I process to get <= max_limit
+// wchar_t objects?
+int utf8_codecvt_facet::do_length(
+    std::mbstate_t &,
+    const char * from,
+    const char * from_end, 
+    std::size_t max_limit
+) const
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+        throw()
+#endif
+{ 
+    // RG - this code is confusing!  I need a better way to express it.
+    // and test cases.
+
+    // Invariants:
+    // 1) last_octet_count has the size of the last measured character
+    // 2) char_count holds the number of characters shown to fit
+    // within the bounds so far (no greater than max_limit)
+    // 3) from_next points to the octet 'last_octet_count' before the
+    // last measured character.  
+    int last_octet_count=0;
+    std::size_t char_count = 0;
+    const char* from_next = from;
+    // Use "<" because the buffer may represent incomplete characters
+    while (from_next+last_octet_count <= from_end && char_count <= max_limit) {
+        from_next += last_octet_count;
+        last_octet_count = (get_octet_count(*from_next));
+        ++char_count;
+    }
+    return static_cast<int>(from_next-from);
+}
+
+unsigned int utf8_codecvt_facet::get_octet_count(
+    unsigned char lead_octet
+){
+    // if the 0-bit (MSB) is 0, then 1 character
+    if (lead_octet <= 0x7f) return 1;
+
+    // Otherwise the count number of consecutive 1 bits starting at MSB
+//    assert(0xc0 <= lead_octet && lead_octet <= 0xfd);
+
+    if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2;
+    else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
+    else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
+    else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
+    else return 6;
+}
+
+namespace detail {
+
+template<std::size_t s>
+int get_cont_octet_out_count_impl(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+    return 2;
+}
+
+template<>
+int get_cont_octet_out_count_impl<4>(wchar_t word){
+    if (word < 0x80) {
+        return 0;
+    }
+    if (word < 0x800) {
+        return 1;
+    }
+
+    // Note that the following code will generate warnings on some platforms
+    // where wchar_t is defined as UCS2.  The warnings are superfluous as the
+    // specialization is never instantitiated with such compilers, but this
+    // can cause problems if warnings are being treated as errors, so we guard
+    // against that.  Including <boost/detail/utf8_codecvt_facet.hpp> as we do
+    // should be enough to get WCHAR_MAX defined.
+#if !defined(WCHAR_MAX)
+#   error WCHAR_MAX not defined!
+#endif
+    // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
+#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
+    return 2;
+#elif WCHAR_MAX > 0x10000
+    
+   if (word < 0x10000) {
+        return 2;
+    }
+    if (word < 0x200000) {
+        return 3;
+    }
+    if (word < 0x4000000) {
+        return 4;
+    }
+    return 5;
+    
+#else
+    return 2;
+#endif
+}
+
+} // namespace detail
+
+// How many "continuing octets" will be needed for this word
+// ==   total octets - 1.
+int utf8_codecvt_facet::get_cont_octet_out_count(
+    wchar_t word
+) const {
+    return detail::get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
+}
+BOOST_UTF8_END_NAMESPACE
+
+#endif