diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/foreach.hpp | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/foreach.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/foreach.hpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/3rdParty/Boost/src/boost/foreach.hpp b/3rdParty/Boost/src/boost/foreach.hpp index 571b45c..ac2e613 100644 --- a/3rdParty/Boost/src/boost/foreach.hpp +++ b/3rdParty/Boost/src/boost/foreach.hpp @@ -1,94 +1,91 @@ /////////////////////////////////////////////////////////////////////////////// // foreach.hpp header file // // Copyright 2004 Eric Niebler. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/foreach for documentation // // Credits: // Anson Tsao - for the initial inspiration and several good suggestions. // Thorsten Ottosen - for Boost.Range, and for suggesting a way to detect // const-qualified rvalues at compile time on VC7.1+ // Russell Hind - For help porting to Borland // Alisdair Meredith - For help porting to Borland // Stefan Slapeta - For help porting to Intel // David Jenkins - For help finding a Microsoft Code Analysis bug // mimomorin@... - For a patch to use rvalue refs on supporting compilers #ifndef BOOST_FOREACH // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif #include <cstddef> #include <utility> // for std::pair #include <boost/config.hpp> #include <boost/detail/workaround.hpp> // Some compilers let us detect even const-qualified rvalues at compile-time -#if !defined(BOOST_NO_RVALUE_REFERENCES) \ - || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ + || defined(BOOST_MSVC) && !defined(_PREFAST_) \ || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \ !defined(BOOST_CLANG)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \ !defined(BOOST_CLANG)) # define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION #else // Some compilers allow temporaries to be bound to non-const references. // These compilers make it impossible to for BOOST_FOREACH to detect // temporaries and avoid reevaluation of the collection expression. -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x593) \ +# if BOOST_WORKAROUND(__BORLANDC__, < 0x593) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) \ || BOOST_WORKAROUND(__DECCXX_VER, <= 60590042) # define BOOST_FOREACH_NO_RVALUE_DETECTION # endif // Some compilers do not correctly implement the lvalue/rvalue conversion // rules of the ternary conditional operator. # if defined(BOOST_FOREACH_NO_RVALUE_DETECTION) \ || defined(BOOST_NO_SFINAE) \ || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(__GNUC__, < 3) \ - || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 2)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 3) && defined(__APPLE_CC__)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) \ || BOOST_WORKAROUND(__SUNPRO_CC, >= 0x5100) \ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) # define BOOST_FOREACH_NO_CONST_RVALUE_DETECTION # else # define BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION # endif #endif #include <boost/mpl/if.hpp> #include <boost/mpl/assert.hpp> #include <boost/mpl/logical.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/noncopyable.hpp> #include <boost/range/end.hpp> #include <boost/range/begin.hpp> #include <boost/range/rend.hpp> #include <boost/range/rbegin.hpp> #include <boost/range/iterator.hpp> #include <boost/range/reverse_iterator.hpp> #include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_abstract.hpp> #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_rvalue_reference.hpp> #include <boost/iterator/iterator_traits.hpp> #include <boost/utility/addressof.hpp> #include <boost/foreach_fwd.hpp> #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION # include <new> # include <boost/aligned_storage.hpp> # include <boost/utility/enable_if.hpp> @@ -196,71 +193,71 @@ boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } namespace boost { namespace foreach_detail_ { /////////////////////////////////////////////////////////////////////////////// // Define some utilities for assessing the properties of expressions // template<typename Bool1, typename Bool2> inline boost::mpl::and_<Bool1, Bool2> *and_(Bool1 *, Bool2 *) { return 0; } template<typename Bool1, typename Bool2, typename Bool3> inline boost::mpl::and_<Bool1, Bool2, Bool3> *and_(Bool1 *, Bool2 *, Bool3 *) { return 0; } template<typename Bool1, typename Bool2> inline boost::mpl::or_<Bool1, Bool2> *or_(Bool1 *, Bool2 *) { return 0; } template<typename Bool1, typename Bool2, typename Bool3> inline boost::mpl::or_<Bool1, Bool2, Bool3> *or_(Bool1 *, Bool2 *, Bool3 *) { return 0; } template<typename Bool1> inline boost::mpl::not_<Bool1> *not_(Bool1 *) { return 0; } template<typename T> inline boost::is_array<T> *is_array_(T const &) { return 0; } template<typename T> inline boost::is_const<T> *is_const_(T &) { return 0; } #ifndef BOOST_FOREACH_NO_RVALUE_DETECTION template<typename T> inline boost::mpl::true_ *is_const_(T const &) { return 0; } #endif -#ifdef BOOST_NO_RVALUE_REFERENCES +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template<typename T> inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } template<typename T> inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } #else template<typename T> inline boost::is_rvalue_reference<T &&> *is_rvalue_(T &&, int) { return 0; } #endif /////////////////////////////////////////////////////////////////////////////// // auto_any_t/auto_any // General utility for putting an object of any type into automatic storage struct auto_any_base { // auto_any_base must evaluate to false in boolean context so that // they can be declared in if() statements. operator bool() const { return false; } }; template<typename T> struct auto_any : auto_any_base { explicit auto_any(T const &t) : item(t) { } // temporaries of type auto_any will be bound to const auto_any_base // references, but we still want to be able to mutate the stored // data, so declare it as mutable. mutable T item; @@ -317,104 +314,100 @@ struct wrap_cstr<wchar_t *> template<> struct wrap_cstr<wchar_t const *> { typedef wrap_cstr<wchar_t const *> type; typedef wchar_t const *iterator; typedef wchar_t const *const_iterator; }; template<typename T> struct is_char_array : mpl::and_< is_array<T> , mpl::or_< is_convertible<T, char const *> , is_convertible<T, wchar_t const *> > > {}; template<typename T, typename C = boost::mpl::false_> struct foreach_iterator { // **** READ THIS IF YOUR COMPILE BREAKS HERE **** // // There is an ambiguity about how to iterate over arrays of char and wchar_t. // Should the last array element be treated as a null terminator to be skipped, or // is it just like any other element in the array? To fix the problem, you must // say which behavior you want. // // To treat the container as a null-terminated string, merely cast it to a // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... // // To treat the container as an array, use boost::as_array() in <boost/range/as_array.hpp>, // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... - #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 BOOST_MPL_ASSERT_MSG( (!is_char_array<T>::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); - #endif // If the type is a pointer to a null terminated string (as opposed // to an array type), there is no ambiguity. typedef BOOST_DEDUCED_TYPENAME wrap_cstr<T>::type container; typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< C , range_const_iterator<container> , range_mutable_iterator<container> >::type type; }; template<typename T, typename C = boost::mpl::false_> struct foreach_reverse_iterator { // **** READ THIS IF YOUR COMPILE BREAKS HERE **** // // There is an ambiguity about how to iterate over arrays of char and wchar_t. // Should the last array element be treated as a null terminator to be skipped, or // is it just like any other element in the array? To fix the problem, you must // say which behavior you want. // // To treat the container as a null-terminated string, merely cast it to a // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... // // To treat the container as an array, use boost::as_array() in <boost/range/as_array.hpp>, // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... - #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 BOOST_MPL_ASSERT_MSG( (!is_char_array<T>::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); - #endif // If the type is a pointer to a null terminated string (as opposed // to an array type), there is no ambiguity. typedef BOOST_DEDUCED_TYPENAME wrap_cstr<T>::type container; typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< C , range_reverse_iterator<container const> , range_reverse_iterator<container> >::type type; }; template<typename T, typename C = boost::mpl::false_> struct foreach_reference : iterator_reference<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type> { }; /////////////////////////////////////////////////////////////////////////////// // encode_type // template<typename T> inline type2type<T> *encode_type(T &, boost::mpl::false_ *) { return 0; } template<typename T> inline type2type<T, const_> *encode_type(T const &, boost::mpl::true_ *) { return 0; } /////////////////////////////////////////////////////////////////////////////// // set_false // inline bool set_false(bool &b) { b = false; return false; } @@ -427,81 +420,81 @@ inline T *&to_ptr(T const &) { static T *t = 0; return t; } // Borland needs a little extra help with arrays #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) template<typename T,std::size_t N> inline T (*&to_ptr(T (&)[N]))[N] { static T (*t)[N] = 0; return t; } /////////////////////////////////////////////////////////////////////////////// // derefof // template<typename T> inline T &derefof(T *t) { // This is a work-around for a compiler bug in Borland. If T* is a pointer to array type U(*)[N], // then dereferencing it results in a U* instead of U(&)[N]. The cast forces the issue. return reinterpret_cast<T &>( *const_cast<char *>( reinterpret_cast<char const volatile *>(t) ) ); } # define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T) #else # define BOOST_FOREACH_DEREFOF(T) (*T) #endif #if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ - && !defined(BOOST_NO_RVALUE_REFERENCES) + && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) /////////////////////////////////////////////////////////////////////////////// // Rvalue references makes it drop-dead simple to detect at compile time // whether an expression is an rvalue. /////////////////////////////////////////////////////////////////////////////// # define BOOST_FOREACH_IS_RVALUE(COL) \ boost::foreach_detail_::is_rvalue_((COL), 0) #elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ - && defined(BOOST_NO_RVALUE_REFERENCES) + && defined(BOOST_NO_CXX11_RVALUE_REFERENCES) /////////////////////////////////////////////////////////////////////////////// // Detect at compile-time whether an expression yields an rvalue or // an lvalue. This is rather non-standard, but some popular compilers // accept it. /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // rvalue_probe // template<typename T> struct rvalue_probe { struct private_type_ {}; // can't ever return an array by value typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< boost::mpl::or_<boost::is_abstract<T>, boost::is_array<T> >, private_type_, T >::type value_type; operator value_type() { return *reinterpret_cast<value_type *>(this); } // never called operator T &() const { return *reinterpret_cast<T *>(const_cast<rvalue_probe *>(this)); } // never called }; template<typename T> rvalue_probe<T> const make_probe(T const &) { return rvalue_probe<T>(); } # define BOOST_FOREACH_IS_RVALUE(COL) \ boost::foreach_detail_::and_( \ boost::foreach_detail_::not_(boost::foreach_detail_::is_array_(COL)) \ , (true ? 0 : boost::foreach_detail_::is_rvalue_( \ (true ? boost::foreach_detail_::make_probe(COL) : (COL)), 0))) #elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// @@ -927,71 +920,71 @@ rderef(auto_any_t cur, type2type<T, C> *) , boost_foreach_argument_dependent_lookup_hack_value)) #if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// // R-values and const R-values supported here with zero runtime overhead /////////////////////////////////////////////////////////////////////////////// // No variable is needed to track the rvalue-ness of the collection expression # define BOOST_FOREACH_PREAMBLE() \ BOOST_FOREACH_SUPPRESS_WARNINGS() // Evaluate the collection expression # define BOOST_FOREACH_EVALUATE(COL) \ (COL) # define BOOST_FOREACH_SHOULD_COPY(COL) \ (true ? 0 : boost::foreach_detail_::or_( \ BOOST_FOREACH_IS_RVALUE(COL) \ , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) #elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// // R-values and const R-values supported here /////////////////////////////////////////////////////////////////////////////// // Declare a variable to track the rvalue-ness of the collection expression # define BOOST_FOREACH_PREAMBLE() \ BOOST_FOREACH_SUPPRESS_WARNINGS() \ if (bool BOOST_FOREACH_ID(_foreach_is_rvalue) = false) {} else // Evaluate the collection expression, and detect if it is an lvalue or and rvalue # define BOOST_FOREACH_EVALUATE(COL) \ (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL)) // The rvalue/lvalue-ness of the collection expression is determined dynamically, unless -// type type is an array or is noncopyable or is non-const, in which case we know it's an lvalue. +// the type is an array or is noncopyable or is non-const, in which case we know it's an lvalue. // If the type happens to be a lightweight proxy, always make a copy. # define BOOST_FOREACH_SHOULD_COPY(COL) \ (boost::foreach_detail_::should_copy_impl( \ true ? 0 : boost::foreach_detail_::or_( \ boost::foreach_detail_::is_array_(COL) \ , BOOST_FOREACH_IS_NONCOPYABLE(COL) \ , boost::foreach_detail_::not_(boost::foreach_detail_::is_const_(COL))) \ , true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \ , &BOOST_FOREACH_ID(_foreach_is_rvalue))) #elif !defined(BOOST_FOREACH_NO_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// // R-values supported here, const R-values NOT supported here /////////////////////////////////////////////////////////////////////////////// // No variable is needed to track the rvalue-ness of the collection expression # define BOOST_FOREACH_PREAMBLE() \ BOOST_FOREACH_SUPPRESS_WARNINGS() // Evaluate the collection expression # define BOOST_FOREACH_EVALUATE(COL) \ (COL) // Determine whether the collection expression is an lvalue or an rvalue. // NOTE: this gets the answer wrong for const rvalues. # define BOOST_FOREACH_SHOULD_COPY(COL) \ (true ? 0 : boost::foreach_detail_::or_( \ boost::foreach_detail_::is_rvalue_((COL), 0) \ , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) #else /////////////////////////////////////////////////////////////////////////////// // R-values NOT supported here /////////////////////////////////////////////////////////////////////////////// |