diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-03-28 15:46:49 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-03-28 15:46:49 (GMT) |
commit | f53a1ef582494458301b97bf6e546be52d7ff7e8 (patch) | |
tree | 7571b5cbcbd8a8f1dd1c966c9045b6cb69f0e295 /3rdParty/Boost/src/boost/iterator/detail | |
parent | 638345680d72ca6acaf123f2c8c1c391f696e371 (diff) | |
download | swift-contrib-f53a1ef582494458301b97bf6e546be52d7ff7e8.zip swift-contrib-f53a1ef582494458301b97bf6e546be52d7ff7e8.tar.bz2 |
Moving submodule contents back.
Diffstat (limited to '3rdParty/Boost/src/boost/iterator/detail')
5 files changed, 564 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/iterator/detail/config_def.hpp b/3rdParty/Boost/src/boost/iterator/detail/config_def.hpp new file mode 100644 index 0000000..fa8d667 --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/detail/config_def.hpp @@ -0,0 +1,137 @@ +// (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(BOOST_MSVC, <= 1300) \ + || 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__, == 2) \ + || 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(BOOST_MSVC, <= 1300) +# define BOOST_ARG_DEPENDENT_TYPENAME typename +# else +# define BOOST_ARG_DEPENDENT_TYPENAME +# endif + +# if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// GCC-2.95 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/3rdParty/Boost/src/boost/iterator/detail/config_undef.hpp b/3rdParty/Boost/src/boost/iterator/detail/config_undef.hpp new file mode 100644 index 0000000..9dcd1d5 --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/detail/config_undef.hpp @@ -0,0 +1,25 @@ +// (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_ARG_DEPENDENT_TYPENAME +#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/3rdParty/Boost/src/boost/iterator/detail/enable_if.hpp b/3rdParty/Boost/src/boost/iterator/detail/enable_if.hpp new file mode 100644 index 0000000..0fd36fc --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/detail/enable_if.hpp @@ -0,0 +1,86 @@ +// (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 + { +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typedef Return type; +# endif + }; + + } // namespace iterators + +} // namespace boost + +#include <boost/iterator/detail/config_undef.hpp> + +#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/3rdParty/Boost/src/boost/iterator/detail/facade_iterator_category.hpp b/3rdParty/Boost/src/boost/iterator/detail/facade_iterator_category.hpp new file mode 100644 index 0000000..2c4771d --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/detail/facade_iterator_category.hpp @@ -0,0 +1,200 @@ +// 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 +// + +// forward declaration +namespace boost { struct use_default; } + +namespace boost { 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. +// +// If writability has been disabled per the above metafunction, the +// result will not be convertible to output_iterator_tag. +// +// Otherwise, if Traversal == single_pass_traversal_tag, the following +// conditions will result in a tag that is convertible both to +// input_iterator_tag and output_iterator_tag: +// +// 1. Reference is a reference to non-const +// 2. Reference is not a reference and is convertible to Value +// +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 +{ +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + // 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 +# 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 +{ +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>)); +# endif + + 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::detail + +# include <boost/iterator/detail/config_undef.hpp> + +#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP diff --git a/3rdParty/Boost/src/boost/iterator/detail/minimum_category.hpp b/3rdParty/Boost/src/boost/iterator/detail/minimum_category.hpp new file mode 100644 index 0000000..96501dd --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/detail/minimum_category.hpp @@ -0,0 +1,116 @@ +// 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 MINIMUM_CATEGORY_DWA20031119_HPP +# define MINIMUM_CATEGORY_DWA20031119_HPP + +# include <boost/type_traits/is_convertible.hpp> +# include <boost/type_traits/is_same.hpp> + +# include <boost/mpl/aux_/lambda_support.hpp> + +namespace boost { namespace detail { +// +// Returns the minimum category type or error_type +// if T1 and T2 are unrelated. +// +// For compilers not supporting is_convertible this only +// works with the new boost return and traversal category +// types. The exact boost _types_ are required. No derived types +// will work. +// +// +template <bool GreaterEqual, bool LessEqual> +struct minimum_category_impl +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +{ + template <class T1, class T2> struct apply + { + typedef T2 type; + }; + typedef void type; +} +# endif +; + +template <class T1, class T2> +struct error_not_related_by_convertibility; + +template <> +struct minimum_category_impl<true,false> +{ + template <class T1, class T2> struct apply + { + typedef T2 type; + }; +}; + +template <> +struct minimum_category_impl<false,true> +{ + template <class T1, class T2> struct apply + { + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl<true,true> +{ + template <class T1, class T2> struct apply + { + BOOST_STATIC_ASSERT((is_same<T1,T2>::value)); + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl<false,false> +{ + template <class T1, class T2> struct apply + : error_not_related_by_convertibility<T1,T2> + { + }; +}; + +template <class T1 = mpl::_1, class T2 = mpl::_2> +struct minimum_category +{ + typedef minimum_category_impl< +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround + is_same<T2,int>::value || +# endif + ::boost::is_convertible<T1,T2>::value + , ::boost::is_convertible<T2,T1>::value +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround + || is_same<T1,int>::value +# endif + > outer; + + typedef typename outer::template apply<T1,T2> inner; + typedef typename inner::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) +}; + +template <> +struct minimum_category<mpl::_1,mpl::_2> +{ + template <class T1, class T2> + struct apply : minimum_category<T1,T2> + {}; + + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) +}; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround +template <> +struct minimum_category<int,int> +{ + typedef int type; +}; +# endif + +}} // namespace boost::detail + +#endif // MINIMUM_CATEGORY_DWA20031119_HPP |