summaryrefslogtreecommitdiffstats
path: root/contrib/src/boost/iterator
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/src/boost/iterator')
-rw-r--r--contrib/src/boost/iterator/detail/config_def.hpp128
-rw-r--r--contrib/src/boost/iterator/detail/config_undef.hpp24
-rw-r--r--contrib/src/boost/iterator/detail/enable_if.hpp83
-rw-r--r--contrib/src/boost/iterator/detail/facade_iterator_category.hpp193
-rw-r--r--contrib/src/boost/iterator/interoperable.hpp54
-rw-r--r--contrib/src/boost/iterator/iterator_adaptor.hpp360
-rw-r--r--contrib/src/boost/iterator/iterator_categories.hpp215
-rw-r--r--contrib/src/boost/iterator/iterator_concepts.hpp275
-rw-r--r--contrib/src/boost/iterator/iterator_facade.hpp980
-rw-r--r--contrib/src/boost/iterator/iterator_traits.hpp60
-rw-r--r--contrib/src/boost/iterator/reverse_iterator.hpp74
-rw-r--r--contrib/src/boost/iterator/transform_iterator.hpp171
12 files changed, 2617 insertions, 0 deletions
diff --git a/contrib/src/boost/iterator/detail/config_def.hpp b/contrib/src/boost/iterator/detail/config_def.hpp
new file mode 100644
index 0000000..117e75a
--- /dev/null
+++ b/contrib/src/boost/iterator/detail/config_def.hpp
@@ -0,0 +1,128 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// no include guard multiple inclusion intended
+
+//
+// This is a temporary workaround until the bulk of this is
+// available in boost config.
+// 23/02/03 thw
+//
+
+#include <boost/config.hpp> // for prior
+#include <boost/detail/workaround.hpp>
+
+#ifdef BOOST_ITERATOR_CONFIG_DEF
+# error you have nested config_def #inclusion.
+#else
+# define BOOST_ITERATOR_CONFIG_DEF
+#endif
+
+// We enable this always now. Otherwise, the simple case in
+// libs/iterator/test/constant_iterator_arrow.cpp fails to compile
+// because the operator-> return is improperly deduced as a non-const
+// pointer.
+#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531))
+
+// Recall that in general, compilers without partial specialization
+// can't strip constness. Consider counting_iterator, which normally
+// passes a const Value to iterator_facade. As a result, any code
+// which makes a std::vector of the iterator's value_type will fail
+// when its allocator declares functions overloaded on reference and
+// const_reference (the same type).
+//
+// Furthermore, Borland 5.5.1 drops constness in enough ways that we
+// end up using a proxy for operator[] when we otherwise shouldn't.
+// Using reference constness gives it an extra hint that it can
+// return the value_type from operator[] directly, but is not
+// strictly necessary. Not sure how best to resolve this one.
+
+# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1
+
+#endif
+
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \
+ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
+ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \
+ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+
+# define BOOST_NO_LVALUE_RETURN_DETECTION
+
+# if 0 // test code
+ struct v {};
+
+ typedef char (&no)[3];
+
+ template <class T>
+ no foo(T const&, ...);
+
+ template <class T>
+ char foo(T&, int);
+
+
+ struct value_iterator
+ {
+ v operator*() const;
+ };
+
+ template <class T>
+ struct lvalue_deref_helper
+ {
+ static T& x;
+ enum { value = (sizeof(foo(*x,0)) == 1) };
+ };
+
+ int z2[(lvalue_deref_helper<v*>::value == 1) ? 1 : -1];
+ int z[(lvalue_deref_helper<value_iterator>::value) == 1 ? -1 : 1 ];
+# endif
+
+#endif
+
+#if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
+# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types"
+#endif
+
+#if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile:
+
+# if 0 // test code
+ #include <boost/type_traits/is_convertible.hpp>
+ template <class T>
+ struct foo
+ {
+ foo(T);
+
+ template <class U>
+ foo(foo<U> const& other) : p(other.p) { }
+
+ T p;
+ };
+
+ bool x = boost::is_convertible<foo<int const*>, foo<int*> >::value;
+# endif
+
+#endif
+
+
+#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE))
+# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+#endif
+
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+
+// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion
+// operators in convertibility checks, causing premature errors.
+//
+// Borland's problems are harder to diagnose due to lack of an
+// instantiation stack backtrace. They may be due in part to the fact
+// that it drops cv-qualification willy-nilly in templates.
+# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+# endif
+
+// no include guard; multiple inclusion intended
diff --git a/contrib/src/boost/iterator/detail/config_undef.hpp b/contrib/src/boost/iterator/detail/config_undef.hpp
new file mode 100644
index 0000000..bf1b8d7
--- /dev/null
+++ b/contrib/src/boost/iterator/detail/config_undef.hpp
@@ -0,0 +1,24 @@
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// no include guard multiple inclusion intended
+
+//
+// This is a temporary workaround until the bulk of this is
+// available in boost config.
+// 23/02/03 thw
+//
+
+#undef BOOST_NO_IS_CONVERTIBLE
+#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE
+#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+#undef BOOST_NO_LVALUE_RETURN_DETECTION
+#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+
+#ifdef BOOST_ITERATOR_CONFIG_DEF
+# undef BOOST_ITERATOR_CONFIG_DEF
+#else
+# error missing or nested #include config_def
+#endif
diff --git a/contrib/src/boost/iterator/detail/enable_if.hpp b/contrib/src/boost/iterator/detail/enable_if.hpp
new file mode 100644
index 0000000..071f5fe
--- /dev/null
+++ b/contrib/src/boost/iterator/detail/enable_if.hpp
@@ -0,0 +1,83 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_ENABLE_IF_23022003THW_HPP
+#define BOOST_ENABLE_IF_23022003THW_HPP
+
+#include <boost/detail/workaround.hpp>
+#include <boost/mpl/identity.hpp>
+
+#include <boost/iterator/detail/config_def.hpp>
+
+//
+// Boost iterators uses its own enable_if cause we need
+// special semantics for deficient compilers.
+// 23/02/03 thw
+//
+
+namespace boost
+{
+
+ namespace iterators
+ {
+ //
+ // Base machinery for all kinds of enable if
+ //
+ template<bool>
+ struct enabled
+ {
+ template<typename T>
+ struct base
+ {
+ typedef T type;
+ };
+ };
+
+ //
+ // For compilers that don't support "Substitution Failure Is Not An Error"
+ // enable_if falls back to always enabled. See comments
+ // on operator implementation for consequences.
+ //
+ template<>
+ struct enabled<false>
+ {
+ template<typename T>
+ struct base
+ {
+#ifdef BOOST_NO_SFINAE
+
+ typedef T type;
+
+ // This way to do it would give a nice error message containing
+ // invalid overload, but has the big disadvantage that
+ // there is no reference to user code in the error message.
+ //
+ // struct invalid_overload;
+ // typedef invalid_overload type;
+ //
+#endif
+ };
+ };
+
+
+ template <class Cond,
+ class Return>
+ struct enable_if
+# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
+ : enabled<(Cond::value)>::template base<Return>
+# else
+ : mpl::identity<Return>
+# endif
+ {
+ };
+
+ } // namespace iterators
+
+} // namespace boost
+
+#include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_ENABLE_IF_23022003THW_HPP
diff --git a/contrib/src/boost/iterator/detail/facade_iterator_category.hpp b/contrib/src/boost/iterator/detail/facade_iterator_category.hpp
new file mode 100644
index 0000000..67fdf44
--- /dev/null
+++ b/contrib/src/boost/iterator/detail/facade_iterator_category.hpp
@@ -0,0 +1,193 @@
+// Copyright David Abrahams 2003. 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 FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
+# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
+
+# include <boost/iterator/iterator_categories.hpp>
+
+# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
+# include <boost/mpl/and.hpp>
+# include <boost/mpl/if.hpp>
+# include <boost/mpl/eval_if.hpp>
+# include <boost/mpl/identity.hpp>
+# include <boost/mpl/assert.hpp>
+
+# include <boost/type_traits/is_same.hpp>
+# include <boost/type_traits/is_const.hpp>
+# include <boost/type_traits/is_reference.hpp>
+# include <boost/type_traits/is_convertible.hpp>
+
+# include <boost/type_traits/is_same.hpp>
+
+# include <boost/iterator/detail/config_def.hpp> // try to keep this last
+
+# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
+# include <boost/detail/indirect_traits.hpp>
+# endif
+
+//
+// iterator_category deduction for iterator_facade
+//
+
+namespace boost {
+namespace iterators {
+
+// forward declaration
+struct use_default;
+
+namespace detail {
+
+struct input_output_iterator_tag
+ : std::input_iterator_tag
+{
+ // Using inheritance for only input_iterator_tag helps to avoid
+ // ambiguities when a stdlib implementation dispatches on a
+ // function which is overloaded on both input_iterator_tag and
+ // output_iterator_tag, as STLPort does, in its __valid_range
+ // function. I claim it's better to avoid the ambiguity in these
+ // cases.
+ operator std::output_iterator_tag() const
+ {
+ return std::output_iterator_tag();
+ }
+};
+
+//
+// True iff the user has explicitly disabled writability of this
+// iterator. Pass the iterator_facade's Value parameter and its
+// nested ::reference type.
+//
+template <class ValueParam, class Reference>
+struct iterator_writability_disabled
+# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic?
+ : mpl::or_<
+ is_const<Reference>
+ , boost::detail::indirect_traits::is_reference_to_const<Reference>
+ , is_const<ValueParam>
+ >
+# else
+ : is_const<ValueParam>
+# endif
+{};
+
+
+//
+// Convert an iterator_facade's traversal category, Value parameter,
+// and ::reference type to an appropriate old-style category.
+//
+// Due to changeset 21683, this now never results in a category convertible
+// to output_iterator_tag.
+//
+// Change at: https://svn.boost.org/trac/boost/changeset/21683
+template <class Traversal, class ValueParam, class Reference>
+struct iterator_facade_default_category
+ : mpl::eval_if<
+ mpl::and_<
+ is_reference<Reference>
+ , is_convertible<Traversal,forward_traversal_tag>
+ >
+ , mpl::eval_if<
+ is_convertible<Traversal,random_access_traversal_tag>
+ , mpl::identity<std::random_access_iterator_tag>
+ , mpl::if_<
+ is_convertible<Traversal,bidirectional_traversal_tag>
+ , std::bidirectional_iterator_tag
+ , std::forward_iterator_tag
+ >
+ >
+ , typename mpl::eval_if<
+ mpl::and_<
+ is_convertible<Traversal, single_pass_traversal_tag>
+
+ // check for readability
+ , is_convertible<Reference, ValueParam>
+ >
+ , mpl::identity<std::input_iterator_tag>
+ , mpl::identity<Traversal>
+ >
+ >
+{
+};
+
+// True iff T is convertible to an old-style iterator category.
+template <class T>
+struct is_iterator_category
+ : mpl::or_<
+ is_convertible<T,std::input_iterator_tag>
+ , is_convertible<T,std::output_iterator_tag>
+ >
+{
+};
+
+template <class T>
+struct is_iterator_traversal
+ : is_convertible<T,incrementable_traversal_tag>
+{};
+
+//
+// A composite iterator_category tag convertible to Category (a pure
+// old-style category) and Traversal (a pure traversal tag).
+// Traversal must be a strict increase of the traversal power given by
+// Category.
+//
+template <class Category, class Traversal>
+struct iterator_category_with_traversal
+ : Category, Traversal
+{
+ // Make sure this isn't used to build any categories where
+ // convertibility to Traversal is redundant. Should just use the
+ // Category element in that case.
+ BOOST_MPL_ASSERT_NOT((
+ is_convertible<
+ typename iterator_category_to_traversal<Category>::type
+ , Traversal
+ >));
+
+ BOOST_MPL_ASSERT((is_iterator_category<Category>));
+ BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
+ BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
+# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
+ BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
+# endif
+};
+
+// Computes an iterator_category tag whose traversal is Traversal and
+// which is appropriate for an iterator
+template <class Traversal, class ValueParam, class Reference>
+struct facade_iterator_category_impl
+{
+ BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
+
+ typedef typename iterator_facade_default_category<
+ Traversal,ValueParam,Reference
+ >::type category;
+
+ typedef typename mpl::if_<
+ is_same<
+ Traversal
+ , typename iterator_category_to_traversal<category>::type
+ >
+ , category
+ , iterator_category_with_traversal<category,Traversal>
+ >::type type;
+};
+
+//
+// Compute an iterator_category for iterator_facade
+//
+template <class CategoryOrTraversal, class ValueParam, class Reference>
+struct facade_iterator_category
+ : mpl::eval_if<
+ is_iterator_category<CategoryOrTraversal>
+ , mpl::identity<CategoryOrTraversal> // old-style categories are fine as-is
+ , facade_iterator_category_impl<CategoryOrTraversal,ValueParam,Reference>
+ >
+{
+};
+
+}}} // namespace boost::iterators::detail
+
+# include <boost/iterator/detail/config_undef.hpp>
+
+#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
diff --git a/contrib/src/boost/iterator/interoperable.hpp b/contrib/src/boost/iterator/interoperable.hpp
new file mode 100644
index 0000000..6f3c872
--- /dev/null
+++ b/contrib/src/boost/iterator/interoperable.hpp
@@ -0,0 +1,54 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_INTEROPERABLE_23022003THW_HPP
+# define BOOST_INTEROPERABLE_23022003THW_HPP
+
+# include <boost/mpl/bool.hpp>
+# include <boost/mpl/or.hpp>
+
+# include <boost/type_traits/is_convertible.hpp>
+
+# include <boost/iterator/detail/config_def.hpp> // must appear last
+
+namespace boost {
+namespace iterators {
+
+ //
+ // Meta function that determines whether two
+ // iterator types are considered interoperable.
+ //
+ // Two iterator types A,B are considered interoperable if either
+ // A is convertible to B or vice versa.
+ // This interoperability definition is in sync with the
+ // standards requirements on constant/mutable container
+ // iterators (23.1 [lib.container.requirements]).
+ //
+ // For compilers that don't support is_convertible
+ // is_interoperable gives false positives. See comments
+ // on operator implementation for consequences.
+ //
+ template <typename A, typename B>
+ struct is_interoperable
+# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+ : mpl::true_
+# else
+ : mpl::or_<
+ is_convertible< A, B >
+ , is_convertible< B, A > >
+# endif
+ {
+ };
+
+} // namespace iterators
+
+using iterators::is_interoperable;
+
+} // namespace boost
+
+# include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_INTEROPERABLE_23022003THW_HPP
diff --git a/contrib/src/boost/iterator/iterator_adaptor.hpp b/contrib/src/boost/iterator/iterator_adaptor.hpp
new file mode 100644
index 0000000..87cfd05
--- /dev/null
+++ b/contrib/src/boost/iterator/iterator_adaptor.hpp
@@ -0,0 +1,360 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
+#define BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
+
+#include <boost/static_assert.hpp>
+#include <boost/iterator.hpp>
+#include <boost/detail/iterator.hpp>
+
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/iterator/detail/enable_if.hpp>
+
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/or.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+
+#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
+# include <boost/type_traits/remove_reference.hpp>
+#endif
+
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/iterator/detail/config_def.hpp>
+
+#include <boost/iterator/iterator_traits.hpp>
+
+namespace boost {
+namespace iterators {
+
+ // Used as a default template argument internally, merely to
+ // indicate "use the default", this can also be passed by users
+ // explicitly in order to specify that the default should be used.
+ struct use_default;
+
+} // namespace iterators
+
+using iterators::use_default;
+
+// the incompleteness of use_default causes massive problems for
+// is_convertible (naturally). This workaround is fortunately not
+// needed for vc6/vc7.
+template<class To>
+struct is_convertible<use_default,To>
+ : mpl::false_ {};
+
+namespace iterators {
+
+ namespace detail
+ {
+
+ //
+ // Result type used in enable_if_convertible meta function.
+ // This can be an incomplete type, as only pointers to
+ // enable_if_convertible< ... >::type are used.
+ // We could have used void for this, but conversion to
+ // void* is just to easy.
+ //
+ struct enable_type;
+ }
+
+
+ //
+ // enable_if for use in adapted iterators constructors.
+ //
+ // In order to provide interoperability between adapted constant and
+ // mutable iterators, adapted iterators will usually provide templated
+ // conversion constructors of the following form
+ //
+ // template <class BaseIterator>
+ // class adapted_iterator :
+ // public iterator_adaptor< adapted_iterator<Iterator>, Iterator >
+ // {
+ // public:
+ //
+ // ...
+ //
+ // template <class OtherIterator>
+ // adapted_iterator(
+ // OtherIterator const& it
+ // , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0);
+ //
+ // ...
+ // };
+ //
+ // enable_if_convertible is used to remove those overloads from the overload
+ // set that cannot be instantiated. For all practical purposes only overloads
+ // for constant/mutable interaction will remain. This has the advantage that
+ // meta functions like boost::is_convertible do not return false positives,
+ // as they can only look at the signature of the conversion constructor
+ // and not at the actual instantiation.
+ //
+ // enable_if_interoperable can be safely used in user code. It falls back to
+ // always enabled for compilers that don't support enable_if or is_convertible.
+ // There is no need for compiler specific workarounds in user code.
+ //
+ // The operators implementation relies on boost::is_convertible not returning
+ // false positives for user/library defined iterator types. See comments
+ // on operator implementation for consequences.
+ //
+# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE)
+
+ template <class From, class To>
+ struct enable_if_convertible
+ {
+ typedef boost::iterators::detail::enable_type type;
+ };
+
+# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292))
+
+ // For some reason vc7.1 needs us to "cut off" instantiation
+ // of is_convertible in a few cases.
+ template<typename From, typename To>
+ struct enable_if_convertible
+ : iterators::enable_if<
+ mpl::or_<
+ is_same<From,To>
+ , is_convertible<From, To>
+ >
+ , boost::iterators::detail::enable_type
+ >
+ {};
+
+# else
+
+ template<typename From, typename To>
+ struct enable_if_convertible
+ : iterators::enable_if<
+ is_convertible<From, To>
+ , boost::iterators::detail::enable_type
+ >
+ {};
+
+# endif
+
+ //
+ // Default template argument handling for iterator_adaptor
+ //
+ namespace detail
+ {
+ // If T is use_default, return the result of invoking
+ // DefaultNullaryFn, otherwise return T.
+ template <class T, class DefaultNullaryFn>
+ struct ia_dflt_help
+ : mpl::eval_if<
+ is_same<T, use_default>
+ , DefaultNullaryFn
+ , mpl::identity<T>
+ >
+ {
+ };
+
+ // A metafunction which computes an iterator_adaptor's base class,
+ // a specialization of iterator_facade.
+ template <
+ class Derived
+ , class Base
+ , class Value
+ , class Traversal
+ , class Reference
+ , class Difference
+ >
+ struct iterator_adaptor_base
+ {
+ typedef iterator_facade<
+ Derived
+
+# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
+ , typename boost::iterators::detail::ia_dflt_help<
+ Value
+ , mpl::eval_if<
+ is_same<Reference,use_default>
+ , iterator_value<Base>
+ , remove_reference<Reference>
+ >
+ >::type
+# else
+ , typename boost::iterators::detail::ia_dflt_help<
+ Value, iterator_value<Base>
+ >::type
+# endif
+
+ , typename boost::iterators::detail::ia_dflt_help<
+ Traversal
+ , iterator_traversal<Base>
+ >::type
+
+ , typename boost::iterators::detail::ia_dflt_help<
+ Reference
+ , mpl::eval_if<
+ is_same<Value,use_default>
+ , iterator_reference<Base>
+ , add_reference<Value>
+ >
+ >::type
+
+ , typename boost::iterators::detail::ia_dflt_help<
+ Difference, iterator_difference<Base>
+ >::type
+ >
+ type;
+ };
+
+ // workaround for aC++ CR JAGaf33512
+ template <class Tr1, class Tr2>
+ inline void iterator_adaptor_assert_traversal ()
+ {
+ BOOST_STATIC_ASSERT((is_convertible<Tr1, Tr2>::value));
+ }
+ }
+
+ //
+ // Iterator Adaptor
+ //
+ // The parameter ordering changed slightly with respect to former
+ // versions of iterator_adaptor The idea is that when the user needs
+ // to fiddle with the reference type it is highly likely that the
+ // iterator category has to be adjusted as well. Any of the
+ // following four template arguments may be ommitted or explicitly
+ // replaced by use_default.
+ //
+ // Value - if supplied, the value_type of the resulting iterator, unless
+ // const. If const, a conforming compiler strips constness for the
+ // value_type. If not supplied, iterator_traits<Base>::value_type is used
+ //
+ // Category - the traversal category of the resulting iterator. If not
+ // supplied, iterator_traversal<Base>::type is used.
+ //
+ // Reference - the reference type of the resulting iterator, and in
+ // particular, the result type of operator*(). If not supplied but
+ // Value is supplied, Value& is used. Otherwise
+ // iterator_traits<Base>::reference is used.
+ //
+ // Difference - the difference_type of the resulting iterator. If not
+ // supplied, iterator_traits<Base>::difference_type is used.
+ //
+ template <
+ class Derived
+ , class Base
+ , class Value = use_default
+ , class Traversal = use_default
+ , class Reference = use_default
+ , class Difference = use_default
+ >
+ class iterator_adaptor
+ : public boost::iterators::detail::iterator_adaptor_base<
+ Derived, Base, Value, Traversal, Reference, Difference
+ >::type
+ {
+ friend class iterator_core_access;
+
+ protected:
+ typedef typename boost::iterators::detail::iterator_adaptor_base<
+ Derived, Base, Value, Traversal, Reference, Difference
+ >::type super_t;
+ public:
+ iterator_adaptor() {}
+
+ explicit iterator_adaptor(Base const &iter)
+ : m_iterator(iter)
+ {
+ }
+
+ typedef Base base_type;
+
+ Base const& base() const
+ { return m_iterator; }
+
+ protected:
+ // for convenience in derived classes
+ typedef iterator_adaptor<Derived,Base,Value,Traversal,Reference,Difference> iterator_adaptor_;
+
+ //
+ // lvalue access to the Base object for Derived
+ //
+ Base const& base_reference() const
+ { return m_iterator; }
+
+ Base& base_reference()
+ { return m_iterator; }
+
+ private:
+ //
+ // Core iterator interface for iterator_facade. This is private
+ // to prevent temptation for Derived classes to use it, which
+ // will often result in an error. Derived classes should use
+ // base_reference(), above, to get direct access to m_iterator.
+ //
+ typename super_t::reference dereference() const
+ { return *m_iterator; }
+
+ template <
+ class OtherDerived, class OtherIterator, class V, class C, class R, class D
+ >
+ bool equal(iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& x) const
+ {
+ // Maybe readd with same_distance
+ // BOOST_STATIC_ASSERT(
+ // (detail::same_category_and_difference<Derived,OtherDerived>::value)
+ // );
+ return m_iterator == x.base();
+ }
+
+ typedef typename iterator_category_to_traversal<
+ typename super_t::iterator_category
+ >::type my_traversal;
+
+# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \
+ boost::iterators::detail::iterator_adaptor_assert_traversal<my_traversal, cat>();
+
+ void advance(typename super_t::difference_type n)
+ {
+ BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag)
+ m_iterator += n;
+ }
+
+ void increment() { ++m_iterator; }
+
+ void decrement()
+ {
+ BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag)
+ --m_iterator;
+ }
+
+ template <
+ class OtherDerived, class OtherIterator, class V, class C, class R, class D
+ >
+ typename super_t::difference_type distance_to(
+ iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& y) const
+ {
+ BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag)
+ // Maybe readd with same_distance
+ // BOOST_STATIC_ASSERT(
+ // (detail::same_category_and_difference<Derived,OtherDerived>::value)
+ // );
+ return y.base() - m_iterator;
+ }
+
+# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL
+
+ private: // data members
+ Base m_iterator;
+ };
+
+} // namespace iterators
+
+using iterators::iterator_adaptor;
+using iterators::enable_if_convertible;
+
+} // namespace boost
+
+#include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
diff --git a/contrib/src/boost/iterator/iterator_categories.hpp b/contrib/src/boost/iterator/iterator_categories.hpp
new file mode 100644
index 0000000..71202c9
--- /dev/null
+++ b/contrib/src/boost/iterator/iterator_categories.hpp
@@ -0,0 +1,215 @@
+// (C) Copyright Jeremy Siek 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_ITERATOR_CATEGORIES_HPP
+# define BOOST_ITERATOR_CATEGORIES_HPP
+
+# include <boost/config.hpp>
+# include <boost/detail/iterator.hpp>
+# include <boost/iterator/detail/config_def.hpp>
+
+# include <boost/detail/workaround.hpp>
+
+# include <boost/mpl/eval_if.hpp>
+# include <boost/mpl/identity.hpp>
+# include <boost/mpl/placeholders.hpp>
+# include <boost/mpl/aux_/lambda_support.hpp>
+
+# include <boost/type_traits/is_convertible.hpp>
+
+# include <boost/static_assert.hpp>
+
+namespace boost {
+namespace iterators {
+
+//
+// Traversal Categories
+//
+
+struct no_traversal_tag {};
+
+struct incrementable_traversal_tag
+ : no_traversal_tag
+{
+// incrementable_traversal_tag() {}
+// incrementable_traversal_tag(std::output_iterator_tag const&) {};
+};
+
+struct single_pass_traversal_tag
+ : incrementable_traversal_tag
+{
+// single_pass_traversal_tag() {}
+// single_pass_traversal_tag(std::input_iterator_tag const&) {};
+};
+
+struct forward_traversal_tag
+ : single_pass_traversal_tag
+{
+// forward_traversal_tag() {}
+// forward_traversal_tag(std::forward_iterator_tag const&) {};
+};
+
+struct bidirectional_traversal_tag
+ : forward_traversal_tag
+{
+// bidirectional_traversal_tag() {};
+// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {};
+};
+
+struct random_access_traversal_tag
+ : bidirectional_traversal_tag
+{
+// random_access_traversal_tag() {};
+// random_access_traversal_tag(std::random_access_iterator_tag const&) {};
+};
+
+namespace detail
+{
+ //
+ // Convert a "strictly old-style" iterator category to a traversal
+ // tag. This is broken out into a separate metafunction to reduce
+ // the cost of instantiating iterator_category_to_traversal, below,
+ // for new-style types.
+ //
+ template <class Cat>
+ struct old_category_to_traversal
+ : mpl::eval_if<
+ is_convertible<Cat,std::random_access_iterator_tag>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::bidirectional_iterator_tag>
+ , mpl::identity<bidirectional_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::forward_iterator_tag>
+ , mpl::identity<forward_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::input_iterator_tag>
+ , mpl::identity<single_pass_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Cat,std::output_iterator_tag>
+ , mpl::identity<incrementable_traversal_tag>
+ , void
+ >
+ >
+ >
+ >
+ >
+ {};
+
+} // namespace detail
+
+//
+// Convert an iterator category into a traversal tag
+//
+template <class Cat>
+struct iterator_category_to_traversal
+ : mpl::eval_if< // if already convertible to a traversal tag, we're done.
+ is_convertible<Cat,incrementable_traversal_tag>
+ , mpl::identity<Cat>
+ , boost::iterators::detail::old_category_to_traversal<Cat>
+ >
+{};
+
+// Trait to get an iterator's traversal category
+template <class Iterator = mpl::_1>
+struct iterator_traversal
+ : iterator_category_to_traversal<
+ typename boost::detail::iterator_traits<Iterator>::iterator_category
+ >
+{};
+
+# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
+// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work
+// out well. Instantiating the nested apply template also
+// requires instantiating iterator_traits on the
+// placeholder. Instead we just specialize it as a metafunction
+// class.
+template <>
+struct iterator_traversal<mpl::_1>
+{
+ template <class T>
+ struct apply : iterator_traversal<T>
+ {};
+};
+template <>
+struct iterator_traversal<mpl::_>
+ : iterator_traversal<mpl::_1>
+{};
+# endif
+
+//
+// Convert an iterator traversal to one of the traversal tags.
+//
+template <class Traversal>
+struct pure_traversal_tag
+ : mpl::eval_if<
+ is_convertible<Traversal,random_access_traversal_tag>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,bidirectional_traversal_tag>
+ , mpl::identity<bidirectional_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,forward_traversal_tag>
+ , mpl::identity<forward_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,single_pass_traversal_tag>
+ , mpl::identity<single_pass_traversal_tag>
+ , mpl::eval_if<
+ is_convertible<Traversal,incrementable_traversal_tag>
+ , mpl::identity<incrementable_traversal_tag>
+ , void
+ >
+ >
+ >
+ >
+ >
+{
+};
+
+//
+// Trait to retrieve one of the iterator traversal tags from the iterator category or traversal.
+//
+template <class Iterator = mpl::_1>
+struct pure_iterator_traversal
+ : pure_traversal_tag<typename iterator_traversal<Iterator>::type>
+{};
+
+# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
+template <>
+struct pure_iterator_traversal<mpl::_1>
+{
+ template <class T>
+ struct apply : pure_iterator_traversal<T>
+ {};
+};
+template <>
+struct pure_iterator_traversal<mpl::_>
+ : pure_iterator_traversal<mpl::_1>
+{};
+# endif
+
+} // namespace iterators
+
+using iterators::no_traversal_tag;
+using iterators::incrementable_traversal_tag;
+using iterators::single_pass_traversal_tag;
+using iterators::forward_traversal_tag;
+using iterators::bidirectional_traversal_tag;
+using iterators::random_access_traversal_tag;
+using iterators::iterator_category_to_traversal;
+using iterators::iterator_traversal;
+
+// This import is needed for backward compatibility with Boost.Range:
+// boost/range/detail/demote_iterator_traversal_tag.hpp
+// It should be removed when that header is fixed.
+namespace detail {
+using iterators::pure_traversal_tag;
+} // namespace detail
+
+} // namespace boost
+
+#include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_ITERATOR_CATEGORIES_HPP
diff --git a/contrib/src/boost/iterator/iterator_concepts.hpp b/contrib/src/boost/iterator/iterator_concepts.hpp
new file mode 100644
index 0000000..1a9f7d6
--- /dev/null
+++ b/contrib/src/boost/iterator/iterator_concepts.hpp
@@ -0,0 +1,275 @@
+// (C) Copyright Jeremy Siek 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_ITERATOR_CONCEPTS_HPP
+#define BOOST_ITERATOR_CONCEPTS_HPP
+
+#include <boost/concept_check.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+
+// Use boost::detail::iterator_traits to work around some MSVC/Dinkumware problems.
+#include <boost/detail/iterator.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_integral.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+
+#include <boost/static_assert.hpp>
+
+// Use boost/limits to work around missing limits headers on some compilers
+#include <boost/limits.hpp>
+#include <boost/config.hpp>
+
+#include <algorithm>
+
+#include <boost/concept/detail/concept_def.hpp>
+
+namespace boost_concepts
+{
+ // Used a different namespace here (instead of "boost") so that the
+ // concept descriptions do not take for granted the names in
+ // namespace boost.
+
+ //===========================================================================
+ // Iterator Access Concepts
+
+ BOOST_concept(ReadableIterator,(Iterator))
+ : boost::Assignable<Iterator>
+ , boost::CopyConstructible<Iterator>
+
+ {
+ typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
+ typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference;
+
+ BOOST_CONCEPT_USAGE(ReadableIterator)
+ {
+
+ value_type v = *i;
+ boost::ignore_unused_variable_warning(v);
+ }
+ private:
+ Iterator i;
+ };
+
+ template <
+ typename Iterator
+ , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
+ >
+ struct WritableIterator
+ : boost::CopyConstructible<Iterator>
+ {
+ BOOST_CONCEPT_USAGE(WritableIterator)
+ {
+ *i = v;
+ }
+ private:
+ ValueType v;
+ Iterator i;
+ };
+
+ template <
+ typename Iterator
+ , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
+ >
+ struct WritableIteratorConcept : WritableIterator<Iterator,ValueType> {};
+
+ BOOST_concept(SwappableIterator,(Iterator))
+ {
+ BOOST_CONCEPT_USAGE(SwappableIterator)
+ {
+ std::iter_swap(i1, i2);
+ }
+ private:
+ Iterator i1;
+ Iterator i2;
+ };
+
+ BOOST_concept(LvalueIterator,(Iterator))
+ {
+ typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
+
+ BOOST_CONCEPT_USAGE(LvalueIterator)
+ {
+ value_type& r = const_cast<value_type&>(*i);
+ boost::ignore_unused_variable_warning(r);
+ }
+ private:
+ Iterator i;
+ };
+
+
+ //===========================================================================
+ // Iterator Traversal Concepts
+
+ BOOST_concept(IncrementableIterator,(Iterator))
+ : boost::Assignable<Iterator>
+ , boost::CopyConstructible<Iterator>
+ {
+ typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
+
+ BOOST_CONCEPT_ASSERT((
+ boost::Convertible<
+ traversal_category
+ , boost::incrementable_traversal_tag
+ >));
+
+ BOOST_CONCEPT_USAGE(IncrementableIterator)
+ {
+ ++i;
+ (void)i++;
+ }
+ private:
+ Iterator i;
+ };
+
+ BOOST_concept(SinglePassIterator,(Iterator))
+ : IncrementableIterator<Iterator>
+ , boost::EqualityComparable<Iterator>
+
+ {
+ BOOST_CONCEPT_ASSERT((
+ boost::Convertible<
+ BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category
+ , boost::single_pass_traversal_tag
+ > ));
+ };
+
+ BOOST_concept(ForwardTraversal,(Iterator))
+ : SinglePassIterator<Iterator>
+ , boost::DefaultConstructible<Iterator>
+ {
+ typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
+
+ BOOST_MPL_ASSERT((boost::is_integral<difference_type>));
+ BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true);
+
+ BOOST_CONCEPT_ASSERT((
+ boost::Convertible<
+ BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category
+ , boost::forward_traversal_tag
+ > ));
+ };
+
+ BOOST_concept(BidirectionalTraversal,(Iterator))
+ : ForwardTraversal<Iterator>
+ {
+ BOOST_CONCEPT_ASSERT((
+ boost::Convertible<
+ BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category
+ , boost::bidirectional_traversal_tag
+ > ));
+
+ BOOST_CONCEPT_USAGE(BidirectionalTraversal)
+ {
+ --i;
+ (void)i--;
+ }
+ private:
+ Iterator i;
+ };
+
+ BOOST_concept(RandomAccessTraversal,(Iterator))
+ : BidirectionalTraversal<Iterator>
+ {
+ BOOST_CONCEPT_ASSERT((
+ boost::Convertible<
+ BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category
+ , boost::random_access_traversal_tag
+ > ));
+
+ BOOST_CONCEPT_USAGE(RandomAccessTraversal)
+ {
+ i += n;
+ i = i + n;
+ i = n + i;
+ i -= n;
+ i = i - n;
+ n = i - j;
+ }
+
+ private:
+ typename BidirectionalTraversal<Iterator>::difference_type n;
+ Iterator i, j;
+ };
+
+ //===========================================================================
+ // Iterator Interoperability
+
+ namespace detail
+ {
+ template <typename Iterator1, typename Iterator2>
+ void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2)
+ {
+ bool b;
+ b = i1 == i2;
+ b = i1 != i2;
+
+ b = i2 == i1;
+ b = i2 != i1;
+ boost::ignore_unused_variable_warning(b);
+ }
+
+ template <typename Iterator1, typename Iterator2>
+ void interop_rand_access_constraints(
+ Iterator1 const& i1, Iterator2 const& i2,
+ boost::random_access_traversal_tag, boost::random_access_traversal_tag)
+ {
+ bool b;
+ typename boost::detail::iterator_traits<Iterator2>::difference_type n;
+ b = i1 < i2;
+ b = i1 <= i2;
+ b = i1 > i2;
+ b = i1 >= i2;
+ n = i1 - i2;
+
+ b = i2 < i1;
+ b = i2 <= i1;
+ b = i2 > i1;
+ b = i2 >= i1;
+ n = i2 - i1;
+ boost::ignore_unused_variable_warning(b);
+ boost::ignore_unused_variable_warning(n);
+ }
+
+ template <typename Iterator1, typename Iterator2>
+ void interop_rand_access_constraints(
+ Iterator1 const&, Iterator2 const&,
+ boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
+ { }
+
+ } // namespace detail
+
+ BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator))
+ {
+ private:
+ typedef typename boost::iterators::pure_iterator_traversal<Iterator>::type traversal_category;
+ typedef typename boost::iterators::pure_iterator_traversal<ConstIterator>::type const_traversal_category;
+
+ public:
+ BOOST_CONCEPT_ASSERT((SinglePassIterator<Iterator>));
+ BOOST_CONCEPT_ASSERT((SinglePassIterator<ConstIterator>));
+
+ BOOST_CONCEPT_USAGE(InteroperableIterator)
+ {
+ detail::interop_single_pass_constraints(i, ci);
+ detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category());
+
+ ci = i;
+ }
+
+ private:
+ Iterator i;
+ ConstIterator ci;
+ };
+
+} // namespace boost_concepts
+
+#include <boost/concept/detail/concept_undef.hpp>
+
+#endif // BOOST_ITERATOR_CONCEPTS_HPP
diff --git a/contrib/src/boost/iterator/iterator_facade.hpp b/contrib/src/boost/iterator/iterator_facade.hpp
new file mode 100644
index 0000000..7b11d0a
--- /dev/null
+++ b/contrib/src/boost/iterator/iterator_facade.hpp
@@ -0,0 +1,980 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP
+#define BOOST_ITERATOR_FACADE_23022003THW_HPP
+
+#include <boost/config.hpp>
+#include <boost/iterator.hpp>
+#include <boost/iterator/interoperable.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+
+#include <boost/iterator/detail/facade_iterator_category.hpp>
+#include <boost/iterator/detail/enable_if.hpp>
+
+#include <boost/static_assert.hpp>
+#include <boost/utility/addressof.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_pointer.hpp>
+#include <boost/type_traits/add_lvalue_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_pod.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/always.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/identity.hpp>
+
+#include <boost/iterator/detail/config_def.hpp> // this goes last
+
+namespace boost {
+namespace iterators {
+
+ // This forward declaration is required for the friend declaration
+ // in iterator_core_access
+ template <class I, class V, class TC, class R, class D> class iterator_facade;
+
+ namespace detail
+ {
+ // A binary metafunction class that always returns bool. VC6
+ // ICEs on mpl::always<bool>, probably because of the default
+ // parameters.
+ struct always_bool2
+ {
+ template <class T, class U>
+ struct apply
+ {
+ typedef bool type;
+ };
+ };
+
+ // The type trait checks if the category or traversal is at least as advanced as the specified required traversal
+ template< typename CategoryOrTraversal, typename Required >
+ struct is_traversal_at_least :
+ public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required >
+ {};
+
+ //
+ // enable if for use in operator implementation.
+ //
+ template <
+ class Facade1
+ , class Facade2
+ , class Return
+ >
+ struct enable_if_interoperable :
+ public boost::iterators::enable_if<
+ is_interoperable< Facade1, Facade2 >
+ , Return
+ >
+ {};
+
+ //
+ // enable if for use in implementation of operators specific for random access traversal.
+ //
+ template <
+ class Facade1
+ , class Facade2
+ , class Return
+ >
+ struct enable_if_interoperable_and_random_access_traversal :
+ public boost::iterators::enable_if<
+ mpl::and_<
+ is_interoperable< Facade1, Facade2 >
+ , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag >
+ , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag >
+ >
+ , Return
+ >
+ {};
+
+ //
+ // Generates associated types for an iterator_facade with the
+ // given parameters.
+ //
+ template <
+ class ValueParam
+ , class CategoryOrTraversal
+ , class Reference
+ , class Difference
+ >
+ struct iterator_facade_types
+ {
+ typedef typename facade_iterator_category<
+ CategoryOrTraversal, ValueParam, Reference
+ >::type iterator_category;
+
+ typedef typename remove_const<ValueParam>::type value_type;
+
+ // Not the real associated pointer type
+ typedef typename mpl::eval_if<
+ boost::iterators::detail::iterator_writability_disabled<ValueParam,Reference>
+ , add_pointer<const value_type>
+ , add_pointer<value_type>
+ >::type pointer;
+
+# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \
+ || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \
+ || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \
+ || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310)
+
+ // To interoperate with some broken library/compiler
+ // combinations, user-defined iterators must be derived from
+ // std::iterator. It is possible to implement a standard
+ // library for broken compilers without this limitation.
+# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1
+
+ typedef
+ iterator<iterator_category, value_type, Difference, pointer, Reference>
+ base;
+# endif
+ };
+
+ // iterators whose dereference operators reference the same value
+ // for all iterators into the same sequence (like many input
+ // iterators) need help with their postfix ++: the referenced
+ // value must be read and stored away before the increment occurs
+ // so that *a++ yields the originally referenced element and not
+ // the next one.
+ template <class Iterator>
+ class postfix_increment_proxy
+ {
+ typedef typename iterator_value<Iterator>::type value_type;
+ public:
+ explicit postfix_increment_proxy(Iterator const& x)
+ : stored_value(*x)
+ {}
+
+ // Returning a mutable reference allows nonsense like
+ // (*r++).mutate(), but it imposes fewer assumptions about the
+ // behavior of the value_type. In particular, recall that
+ // (*r).mutate() is legal if operator* returns by value.
+ value_type&
+ operator*() const
+ {
+ return this->stored_value;
+ }
+ private:
+ mutable value_type stored_value;
+ };
+
+ //
+ // In general, we can't determine that such an iterator isn't
+ // writable -- we also need to store a copy of the old iterator so
+ // that it can be written into.
+ template <class Iterator>
+ class writable_postfix_increment_proxy
+ {
+ typedef typename iterator_value<Iterator>::type value_type;
+ public:
+ explicit writable_postfix_increment_proxy(Iterator const& x)
+ : stored_value(*x)
+ , stored_iterator(x)
+ {}
+
+ // Dereferencing must return a proxy so that both *r++ = o and
+ // value_type(*r++) can work. In this case, *r is the same as
+ // *r++, and the conversion operator below is used to ensure
+ // readability.
+ writable_postfix_increment_proxy const&
+ operator*() const
+ {
+ return *this;
+ }
+
+ // Provides readability of *r++
+ operator value_type&() const
+ {
+ return stored_value;
+ }
+
+ // Provides writability of *r++
+ template <class T>
+ T const& operator=(T const& x) const
+ {
+ *this->stored_iterator = x;
+ return x;
+ }
+
+ // This overload just in case only non-const objects are writable
+ template <class T>
+ T& operator=(T& x) const
+ {
+ *this->stored_iterator = x;
+ return x;
+ }
+
+ // Provides X(r++)
+ operator Iterator const&() const
+ {
+ return stored_iterator;
+ }
+
+ private:
+ mutable value_type stored_value;
+ Iterator stored_iterator;
+ };
+
+# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <class Reference, class Value>
+ struct is_non_proxy_reference_impl
+ {
+ static Reference r;
+
+ template <class R>
+ static typename mpl::if_<
+ is_convertible<
+ R const volatile*
+ , Value const volatile*
+ >
+ , char[1]
+ , char[2]
+ >::type& helper(R const&);
+
+ BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1);
+ };
+
+ template <class Reference, class Value>
+ struct is_non_proxy_reference
+ : mpl::bool_<
+ is_non_proxy_reference_impl<Reference, Value>::value
+ >
+ {};
+# else
+ template <class Reference, class Value>
+ struct is_non_proxy_reference
+ : is_convertible<
+ typename remove_reference<Reference>::type
+ const volatile*
+ , Value const volatile*
+ >
+ {};
+# endif
+
+ // A metafunction to choose the result type of postfix ++
+ //
+ // Because the C++98 input iterator requirements say that *r++ has
+ // type T (value_type), implementations of some standard
+ // algorithms like lexicographical_compare may use constructions
+ // like:
+ //
+ // *r++ < *s++
+ //
+ // If *r++ returns a proxy (as required if r is writable but not
+ // multipass), this sort of expression will fail unless the proxy
+ // supports the operator<. Since there are any number of such
+ // operations, we're not going to try to support them. Therefore,
+ // even if r++ returns a proxy, *r++ will only return a proxy if
+ // *r also returns a proxy.
+ template <class Iterator, class Value, class Reference, class CategoryOrTraversal>
+ struct postfix_increment_result
+ : mpl::eval_if<
+ mpl::and_<
+ // A proxy is only needed for readable iterators
+ is_convertible<
+ Reference
+ // Use add_lvalue_reference to form `reference to Value` due to
+ // some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject
+ // 'reference-to-reference' in the template which described in CWG
+ // DR106.
+ // http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106
+ , typename add_lvalue_reference<Value const>::type
+ >
+
+ // No multipass iterator can have values that disappear
+ // before positions can be re-visited
+ , mpl::not_<
+ is_convertible<
+ typename iterator_category_to_traversal<CategoryOrTraversal>::type
+ , forward_traversal_tag
+ >
+ >
+ >
+ , mpl::if_<
+ is_non_proxy_reference<Reference,Value>
+ , postfix_increment_proxy<Iterator>
+ , writable_postfix_increment_proxy<Iterator>
+ >
+ , mpl::identity<Iterator>
+ >
+ {};
+
+ // operator->() needs special support for input iterators to strictly meet the
+ // standard's requirements. If *i is not a reference type, we must still
+ // produce an lvalue to which a pointer can be formed. We do that by
+ // returning a proxy object containing an instance of the reference object.
+ template <class Reference, class Pointer>
+ struct operator_arrow_dispatch // proxy references
+ {
+ struct proxy
+ {
+ explicit proxy(Reference const & x) : m_ref(x) {}
+ Reference* operator->() { return boost::addressof(m_ref); }
+ // This function is needed for MWCW and BCC, which won't call
+ // operator-> again automatically per 13.3.1.2 para 8
+ operator Reference*() { return boost::addressof(m_ref); }
+ Reference m_ref;
+ };
+ typedef proxy result_type;
+ static result_type apply(Reference const & x)
+ {
+ return result_type(x);
+ }
+ };
+
+ template <class T, class Pointer>
+ struct operator_arrow_dispatch<T&, Pointer> // "real" references
+ {
+ typedef Pointer result_type;
+ static result_type apply(T& x)
+ {
+ return boost::addressof(x);
+ }
+ };
+
+ // A proxy return type for operator[], needed to deal with
+ // iterators that may invalidate referents upon destruction.
+ // Consider the temporary iterator in *(a + n)
+ template <class Iterator>
+ class operator_brackets_proxy
+ {
+ // Iterator is actually an iterator_facade, so we do not have to
+ // go through iterator_traits to access the traits.
+ typedef typename Iterator::reference reference;
+ typedef typename Iterator::value_type value_type;
+
+ public:
+ operator_brackets_proxy(Iterator const& iter)
+ : m_iter(iter)
+ {}
+
+ operator reference() const
+ {
+ return *m_iter;
+ }
+
+ operator_brackets_proxy& operator=(value_type const& val)
+ {
+ *m_iter = val;
+ return *this;
+ }
+
+ private:
+ Iterator m_iter;
+ };
+
+ // A metafunction that determines whether operator[] must return a
+ // proxy, or whether it can simply return a copy of the value_type.
+ template <class ValueType, class Reference>
+ struct use_operator_brackets_proxy
+ : mpl::not_<
+ mpl::and_<
+ // Really we want an is_copy_constructible trait here,
+ // but is_POD will have to suffice in the meantime.
+ boost::is_POD<ValueType>
+ , iterator_writability_disabled<ValueType,Reference>
+ >
+ >
+ {};
+
+ template <class Iterator, class Value, class Reference>
+ struct operator_brackets_result
+ {
+ typedef typename mpl::if_<
+ use_operator_brackets_proxy<Value,Reference>
+ , operator_brackets_proxy<Iterator>
+ , Value
+ >::type type;
+ };
+
+ template <class Iterator>
+ operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, mpl::true_)
+ {
+ return operator_brackets_proxy<Iterator>(iter);
+ }
+
+ template <class Iterator>
+ typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_)
+ {
+ return *iter;
+ }
+
+ struct choose_difference_type
+ {
+ template <class I1, class I2>
+ struct apply
+ :
+# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+ iterator_difference<I1>
+# else
+ mpl::eval_if<
+ is_convertible<I2,I1>
+ , iterator_difference<I1>
+ , iterator_difference<I2>
+ >
+# endif
+ {};
+
+ };
+
+ template <
+ class Derived
+ , class Value
+ , class CategoryOrTraversal
+ , class Reference
+ , class Difference
+ , bool IsBidirectionalTraversal
+ , bool IsRandomAccessTraversal
+ >
+ class iterator_facade_base;
+
+ } // namespace detail
+
+
+ // Macros which describe the declarations of binary operators
+# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
+# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
+ template < \
+ class Derived1, class V1, class TC1, class Reference1, class Difference1 \
+ , class Derived2, class V2, class TC2, class Reference2, class Difference2 \
+ > \
+ prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \
+ operator op( \
+ iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
+ , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
+# else
+# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
+ template < \
+ class Derived1, class V1, class TC1, class Reference1, class Difference1 \
+ , class Derived2, class V2, class TC2, class Reference2, class Difference2 \
+ > \
+ prefix typename enabler< \
+ Derived1, Derived2 \
+ , typename mpl::apply2<result_type,Derived1,Derived2>::type \
+ >::type \
+ operator op( \
+ iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
+ , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
+# endif
+
+# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
+ BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable)
+
+# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \
+ BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal)
+
+# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \
+ template <class Derived, class V, class TC, class R, class D> \
+ prefix typename boost::iterators::enable_if< \
+ boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \
+ Derived \
+ >::type operator+ args
+
+ //
+ // Helper class for granting access to the iterator core interface.
+ //
+ // The simple core interface is used by iterator_facade. The core
+ // interface of a user/library defined iterator type should not be made public
+ // so that it does not clutter the public interface. Instead iterator_core_access
+ // should be made friend so that iterator_facade can access the core
+ // interface through iterator_core_access.
+ //
+ class iterator_core_access
+ {
+# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+ // Tasteless as this may seem, making all members public allows member templates
+ // to work in the absence of member template friends.
+ public:
+# else
+
+ template <class I, class V, class TC, class R, class D> friend class iterator_facade;
+ template <class I, class V, class TC, class R, class D, bool IsBidirectionalTraversal, bool IsRandomAccessTraversal>
+ friend class detail::iterator_facade_base;
+
+# define BOOST_ITERATOR_FACADE_RELATION(op) \
+ BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2);
+
+ BOOST_ITERATOR_FACADE_RELATION(==)
+ BOOST_ITERATOR_FACADE_RELATION(!=)
+
+# undef BOOST_ITERATOR_FACADE_RELATION
+
+# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \
+ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2);
+
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=)
+
+# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
+
+ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(
+ friend, -, boost::iterators::detail::choose_difference_type)
+ ;
+
+ BOOST_ITERATOR_FACADE_PLUS_HEAD(
+ friend inline
+ , (iterator_facade<Derived, V, TC, R, D> const&
+ , typename Derived::difference_type)
+ )
+ ;
+
+ BOOST_ITERATOR_FACADE_PLUS_HEAD(
+ friend inline
+ , (typename Derived::difference_type
+ , iterator_facade<Derived, V, TC, R, D> const&)
+ )
+ ;
+
+# endif
+
+ template <class Facade>
+ static typename Facade::reference dereference(Facade const& f)
+ {
+ return f.dereference();
+ }
+
+ template <class Facade>
+ static void increment(Facade& f)
+ {
+ f.increment();
+ }
+
+ template <class Facade>
+ static void decrement(Facade& f)
+ {
+ f.decrement();
+ }
+
+ template <class Facade1, class Facade2>
+ static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_)
+ {
+ return f1.equal(f2);
+ }
+
+ template <class Facade1, class Facade2>
+ static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_)
+ {
+ return f2.equal(f1);
+ }
+
+ template <class Facade>
+ static void advance(Facade& f, typename Facade::difference_type n)
+ {
+ f.advance(n);
+ }
+
+ template <class Facade1, class Facade2>
+ static typename Facade1::difference_type distance_from(
+ Facade1 const& f1, Facade2 const& f2, mpl::true_)
+ {
+ return -f1.distance_to(f2);
+ }
+
+ template <class Facade1, class Facade2>
+ static typename Facade2::difference_type distance_from(
+ Facade1 const& f1, Facade2 const& f2, mpl::false_)
+ {
+ return f2.distance_to(f1);
+ }
+
+ //
+ // Curiously Recurring Template interface.
+ //
+ template <class I, class V, class TC, class R, class D>
+ static I& derived(iterator_facade<I,V,TC,R,D>& facade)
+ {
+ return *static_cast<I*>(&facade);
+ }
+
+ template <class I, class V, class TC, class R, class D>
+ static I const& derived(iterator_facade<I,V,TC,R,D> const& facade)
+ {
+ return *static_cast<I const*>(&facade);
+ }
+
+ // objects of this class are useless
+ BOOST_DELETED_FUNCTION(iterator_core_access())
+ };
+
+ namespace detail {
+
+ // Implementation for forward traversal iterators
+ template <
+ class Derived
+ , class Value
+ , class CategoryOrTraversal
+ , class Reference
+ , class Difference
+ >
+ class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
+# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
+ : public boost::iterators::detail::iterator_facade_types<
+ Value, CategoryOrTraversal, Reference, Difference
+ >::base
+# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
+# endif
+ {
+ private:
+ typedef boost::iterators::detail::iterator_facade_types<
+ Value, CategoryOrTraversal, Reference, Difference
+ > associated_types;
+
+ typedef boost::iterators::detail::operator_arrow_dispatch<
+ Reference
+ , typename associated_types::pointer
+ > operator_arrow_dispatch_;
+
+ public:
+ typedef typename associated_types::value_type value_type;
+ typedef Reference reference;
+ typedef Difference difference_type;
+
+ typedef typename operator_arrow_dispatch_::result_type pointer;
+
+ typedef typename associated_types::iterator_category iterator_category;
+
+ public:
+ reference operator*() const
+ {
+ return iterator_core_access::dereference(this->derived());
+ }
+
+ pointer operator->() const
+ {
+ return operator_arrow_dispatch_::apply(*this->derived());
+ }
+
+ Derived& operator++()
+ {
+ iterator_core_access::increment(this->derived());
+ return this->derived();
+ }
+
+ protected:
+ //
+ // Curiously Recurring Template interface.
+ //
+ Derived& derived()
+ {
+ return *static_cast<Derived*>(this);
+ }
+
+ Derived const& derived() const
+ {
+ return *static_cast<Derived const*>(this);
+ }
+ };
+
+ // Implementation for bidirectional traversal iterators
+ template <
+ class Derived
+ , class Value
+ , class CategoryOrTraversal
+ , class Reference
+ , class Difference
+ >
+ class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > :
+ public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
+ {
+ public:
+ Derived& operator--()
+ {
+ iterator_core_access::decrement(this->derived());
+ return this->derived();
+ }
+
+ Derived operator--(int)
+ {
+ Derived tmp(this->derived());
+ --*this;
+ return tmp;
+ }
+ };
+
+ // Implementation for random access traversal iterators
+ template <
+ class Derived
+ , class Value
+ , class CategoryOrTraversal
+ , class Reference
+ , class Difference
+ >
+ class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > :
+ public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >
+ {
+ private:
+ typedef iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type;
+
+ public:
+ typedef typename base_type::reference reference;
+ typedef typename base_type::difference_type difference_type;
+
+ public:
+ typename boost::iterators::detail::operator_brackets_result<Derived, Value, reference>::type
+ operator[](difference_type n) const
+ {
+ typedef boost::iterators::detail::use_operator_brackets_proxy<Value, Reference> use_proxy;
+
+ return boost::iterators::detail::make_operator_brackets_result<Derived>(
+ this->derived() + n
+ , use_proxy()
+ );
+ }
+
+ Derived& operator+=(difference_type n)
+ {
+ iterator_core_access::advance(this->derived(), n);
+ return this->derived();
+ }
+
+ Derived& operator-=(difference_type n)
+ {
+ iterator_core_access::advance(this->derived(), -n);
+ return this->derived();
+ }
+
+ Derived operator-(difference_type x) const
+ {
+ Derived result(this->derived());
+ return result -= x;
+ }
+ };
+
+ } // namespace detail
+
+ //
+ // iterator_facade - use as a public base class for defining new
+ // standard-conforming iterators.
+ //
+ template <
+ class Derived // The derived iterator type being constructed
+ , class Value
+ , class CategoryOrTraversal
+ , class Reference = Value&
+ , class Difference = std::ptrdiff_t
+ >
+ class iterator_facade :
+ public detail::iterator_facade_base<
+ Derived,
+ Value,
+ CategoryOrTraversal,
+ Reference,
+ Difference,
+ detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value,
+ detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value
+ >
+ {
+ protected:
+ // For use by derived classes
+ typedef iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference> iterator_facade_;
+ };
+
+ template <class I, class V, class TC, class R, class D>
+ inline typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
+ operator++(
+ iterator_facade<I,V,TC,R,D>& i
+ , int
+ )
+ {
+ typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
+ tmp(*static_cast<I*>(&i));
+
+ ++i;
+
+ return tmp;
+ }
+
+
+ //
+ // Comparison operator implementation. The library supplied operators
+ // enables the user to provide fully interoperable constant/mutable
+ // iterator types. I.e. the library provides all operators
+ // for all mutable/constant iterator combinations.
+ //
+ // Note though that this kind of interoperability for constant/mutable
+ // iterators is not required by the standard for container iterators.
+ // All the standard asks for is a conversion mutable -> constant.
+ // Most standard library implementations nowadays provide fully interoperable
+ // iterator implementations, but there are still heavily used implementations
+ // that do not provide them. (Actually it's even worse, they do not provide
+ // them for only a few iterators.)
+ //
+ // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should
+ // enable the user to turn off mixed type operators
+ //
+ // The library takes care to provide only the right operator overloads.
+ // I.e.
+ //
+ // bool operator==(Iterator, Iterator);
+ // bool operator==(ConstIterator, Iterator);
+ // bool operator==(Iterator, ConstIterator);
+ // bool operator==(ConstIterator, ConstIterator);
+ //
+ // ...
+ //
+ // In order to do so it uses c++ idioms that are not yet widely supported
+ // by current compiler releases. The library is designed to degrade gracefully
+ // in the face of compiler deficiencies. In general compiler
+ // deficiencies result in less strict error checking and more obscure
+ // error messages, functionality is not affected.
+ //
+ // For full operation compiler support for "Substitution Failure Is Not An Error"
+ // (aka. enable_if) and boost::is_convertible is required.
+ //
+ // The following problems occur if support is lacking.
+ //
+ // Pseudo code
+ //
+ // ---------------
+ // AdaptorA<Iterator1> a1;
+ // AdaptorA<Iterator2> a2;
+ //
+ // // This will result in a no such overload error in full operation
+ // // If enable_if or is_convertible is not supported
+ // // The instantiation will fail with an error hopefully indicating that
+ // // there is no operator== for Iterator1, Iterator2
+ // // The same will happen if no enable_if is used to remove
+ // // false overloads from the templated conversion constructor
+ // // of AdaptorA.
+ //
+ // a1 == a2;
+ // ----------------
+ //
+ // AdaptorA<Iterator> a;
+ // AdaptorB<Iterator> b;
+ //
+ // // This will result in a no such overload error in full operation
+ // // If enable_if is not supported the static assert used
+ // // in the operator implementation will fail.
+ // // This will accidently work if is_convertible is not supported.
+ //
+ // a == b;
+ // ----------------
+ //
+
+# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
+# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_()
+# else
+# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible<a,b>()
+# endif
+
+# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \
+ BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \
+ { \
+ /* For those compilers that do not support enable_if */ \
+ BOOST_STATIC_ASSERT(( \
+ is_interoperable< Derived1, Derived2 >::value \
+ )); \
+ return_prefix iterator_core_access::base_op( \
+ *static_cast<Derived1 const*>(&lhs) \
+ , *static_cast<Derived2 const*>(&rhs) \
+ , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
+ ); \
+ }
+
+# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
+ BOOST_ITERATOR_FACADE_INTEROP( \
+ op \
+ , boost::iterators::detail::always_bool2 \
+ , return_prefix \
+ , base_op \
+ )
+
+ BOOST_ITERATOR_FACADE_RELATION(==, return, equal)
+ BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
+
+# undef BOOST_ITERATOR_FACADE_RELATION
+
+
+# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \
+ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \
+ { \
+ /* For those compilers that do not support enable_if */ \
+ BOOST_STATIC_ASSERT(( \
+ is_interoperable< Derived1, Derived2 >::value && \
+ boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \
+ boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \
+ )); \
+ return_prefix iterator_core_access::base_op( \
+ *static_cast<Derived1 const*>(&lhs) \
+ , *static_cast<Derived2 const*>(&rhs) \
+ , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
+ ); \
+ }
+
+# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \
+ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
+ op \
+ , boost::iterators::detail::always_bool2 \
+ , return_prefix \
+ , base_op \
+ )
+
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from)
+ BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from)
+
+# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
+
+ // operator- requires an additional part in the static assertion
+ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(
+ -
+ , boost::iterators::detail::choose_difference_type
+ , return
+ , distance_from
+ )
+
+# undef BOOST_ITERATOR_FACADE_INTEROP
+# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS
+
+# define BOOST_ITERATOR_FACADE_PLUS(args) \
+ BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \
+ { \
+ Derived tmp(static_cast<Derived const&>(i)); \
+ return tmp += n; \
+ }
+
+ BOOST_ITERATOR_FACADE_PLUS((
+ iterator_facade<Derived, V, TC, R, D> const& i
+ , typename Derived::difference_type n
+ ))
+
+ BOOST_ITERATOR_FACADE_PLUS((
+ typename Derived::difference_type n
+ , iterator_facade<Derived, V, TC, R, D> const& i
+ ))
+
+# undef BOOST_ITERATOR_FACADE_PLUS
+# undef BOOST_ITERATOR_FACADE_PLUS_HEAD
+
+# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
+# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
+# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL
+
+} // namespace iterators
+
+using iterators::iterator_core_access;
+using iterators::iterator_facade;
+
+} // namespace boost
+
+#include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP
diff --git a/contrib/src/boost/iterator/iterator_traits.hpp b/contrib/src/boost/iterator/iterator_traits.hpp
new file mode 100644
index 0000000..1a5f1e0
--- /dev/null
+++ b/contrib/src/boost/iterator/iterator_traits.hpp
@@ -0,0 +1,60 @@
+// Copyright David Abrahams 2003.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef ITERATOR_TRAITS_DWA200347_HPP
+# define ITERATOR_TRAITS_DWA200347_HPP
+
+# include <boost/detail/iterator.hpp>
+# include <boost/detail/workaround.hpp>
+
+namespace boost {
+namespace iterators {
+
+// Macro for supporting old compilers, no longer needed but kept
+// for backwards compatibility (it was documented).
+#define BOOST_ITERATOR_CATEGORY iterator_category
+
+
+template <class Iterator>
+struct iterator_value
+{
+ typedef typename boost::detail::iterator_traits<Iterator>::value_type type;
+};
+
+template <class Iterator>
+struct iterator_reference
+{
+ typedef typename boost::detail::iterator_traits<Iterator>::reference type;
+};
+
+
+template <class Iterator>
+struct iterator_pointer
+{
+ typedef typename boost::detail::iterator_traits<Iterator>::pointer type;
+};
+
+template <class Iterator>
+struct iterator_difference
+{
+ typedef typename boost::detail::iterator_traits<Iterator>::difference_type type;
+};
+
+template <class Iterator>
+struct iterator_category
+{
+ typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type;
+};
+
+} // namespace iterators
+
+using iterators::iterator_value;
+using iterators::iterator_reference;
+using iterators::iterator_pointer;
+using iterators::iterator_difference;
+using iterators::iterator_category;
+
+} // namespace boost
+
+#endif // ITERATOR_TRAITS_DWA200347_HPP
diff --git a/contrib/src/boost/iterator/reverse_iterator.hpp b/contrib/src/boost/iterator/reverse_iterator.hpp
new file mode 100644
index 0000000..3bef39e
--- /dev/null
+++ b/contrib/src/boost/iterator/reverse_iterator.hpp
@@ -0,0 +1,74 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
+#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
+
+#include <boost/next_prior.hpp>
+#include <boost/iterator.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+
+namespace boost {
+namespace iterators {
+
+ //
+ //
+ //
+ template <class Iterator>
+ class reverse_iterator
+ : public iterator_adaptor< reverse_iterator<Iterator>, Iterator >
+ {
+ typedef iterator_adaptor< reverse_iterator<Iterator>, Iterator > super_t;
+
+ friend class iterator_core_access;
+
+ public:
+ reverse_iterator() {}
+
+ explicit reverse_iterator(Iterator x)
+ : super_t(x) {}
+
+ template<class OtherIterator>
+ reverse_iterator(
+ reverse_iterator<OtherIterator> const& r
+ , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
+ )
+ : super_t(r.base())
+ {}
+
+ private:
+ typename super_t::reference dereference() const { return *boost::prior(this->base()); }
+
+ void increment() { --this->base_reference(); }
+ void decrement() { ++this->base_reference(); }
+
+ void advance(typename super_t::difference_type n)
+ {
+ this->base_reference() += -n;
+ }
+
+ template <class OtherIterator>
+ typename super_t::difference_type
+ distance_to(reverse_iterator<OtherIterator> const& y) const
+ {
+ return this->base_reference() - y.base();
+ }
+ };
+
+ template <class BidirectionalIterator>
+ inline reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
+ {
+ return reverse_iterator<BidirectionalIterator>(x);
+ }
+
+} // namespace iterators
+
+using iterators::reverse_iterator;
+using iterators::make_reverse_iterator;
+
+} // namespace boost
+
+#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP
diff --git a/contrib/src/boost/iterator/transform_iterator.hpp b/contrib/src/boost/iterator/transform_iterator.hpp
new file mode 100644
index 0000000..851f16f
--- /dev/null
+++ b/contrib/src/boost/iterator/transform_iterator.hpp
@@ -0,0 +1,171 @@
+// (C) Copyright David Abrahams 2002.
+// (C) Copyright Jeremy Siek 2002.
+// (C) Copyright Thomas Witt 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
+#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
+
+#include <boost/iterator.hpp>
+#include <boost/iterator/detail/enable_if.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/function_traits.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/result_of.hpp>
+
+
+#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
+# include <boost/type_traits/is_base_and_derived.hpp>
+
+#endif
+#include <boost/iterator/detail/config_def.hpp>
+
+
+namespace boost {
+namespace iterators {
+
+ template <class UnaryFunction, class Iterator, class Reference = use_default, class Value = use_default>
+ class transform_iterator;
+
+ namespace detail
+ {
+ // Compute the iterator_adaptor instantiation to be used for transform_iterator
+ template <class UnaryFunc, class Iterator, class Reference, class Value>
+ struct transform_iterator_base
+ {
+ private:
+ // By default, dereferencing the iterator yields the same as
+ // the function.
+ typedef typename ia_dflt_help<
+ Reference
+ , result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
+ >::type reference;
+
+ // To get the default for Value: remove any reference on the
+ // result type, but retain any constness to signal
+ // non-writability. Note that if we adopt Thomas' suggestion
+ // to key non-writability *only* on the Reference argument,
+ // we'd need to strip constness here as well.
+ typedef typename ia_dflt_help<
+ Value
+ , remove_reference<reference>
+ >::type cv_value_type;
+
+ public:
+ typedef iterator_adaptor<
+ transform_iterator<UnaryFunc, Iterator, Reference, Value>
+ , Iterator
+ , cv_value_type
+ , use_default // Leave the traversal category alone
+ , reference
+ > type;
+ };
+ }
+
+ template <class UnaryFunc, class Iterator, class Reference, class Value>
+ class transform_iterator
+ : public boost::iterators::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
+ {
+ typedef typename
+ boost::iterators::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
+ super_t;
+
+ friend class iterator_core_access;
+
+ public:
+ transform_iterator() { }
+
+ transform_iterator(Iterator const& x, UnaryFunc f)
+ : super_t(x), m_f(f) { }
+
+ explicit transform_iterator(Iterator const& x)
+ : super_t(x)
+ {
+ // Pro8 is a little too aggressive about instantiating the
+ // body of this function.
+#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ // don't provide this constructor if UnaryFunc is a
+ // function pointer type, since it will be 0. Too dangerous.
+ BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
+#endif
+ }
+
+ template <
+ class OtherUnaryFunction
+ , class OtherIterator
+ , class OtherReference
+ , class OtherValue>
+ transform_iterator(
+ transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
+ , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
+#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ , typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
+#endif
+ )
+ : super_t(t.base()), m_f(t.functor())
+ {}
+
+ UnaryFunc functor() const
+ { return m_f; }
+
+ private:
+ typename super_t::reference dereference() const
+ { return m_f(*this->base()); }
+
+ // Probably should be the initial base class so it can be
+ // optimized away via EBO if it is an empty class.
+ UnaryFunc m_f;
+ };
+
+ template <class UnaryFunc, class Iterator>
+ inline transform_iterator<UnaryFunc, Iterator>
+ make_transform_iterator(Iterator it, UnaryFunc fun)
+ {
+ return transform_iterator<UnaryFunc, Iterator>(it, fun);
+ }
+
+ // Version which allows explicit specification of the UnaryFunc
+ // type.
+ //
+ // This generator is not provided if UnaryFunc is a function
+ // pointer type, because it's too dangerous: the default-constructed
+ // function pointer in the iterator be 0, leading to a runtime
+ // crash.
+ template <class UnaryFunc, class Iterator>
+ inline typename iterators::enable_if<
+ is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
+ , transform_iterator<UnaryFunc, Iterator>
+ >::type
+ make_transform_iterator(Iterator it)
+ {
+ return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc());
+ }
+
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ template <class Return, class Argument, class Iterator>
+ inline transform_iterator< Return (*)(Argument), Iterator, Return>
+ make_transform_iterator(Iterator it, Return (*fun)(Argument))
+ {
+ return transform_iterator<Return (*)(Argument), Iterator, Return>(it, fun);
+ }
+#endif
+
+} // namespace iterators
+
+using iterators::transform_iterator;
+using iterators::make_transform_iterator;
+
+} // namespace boost
+
+#include <boost/iterator/detail/config_undef.hpp>
+
+#endif // BOOST_TRANSFORM_ITERATOR_23022003THW_HPP