diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-03-14 18:35:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-03-14 18:35:17 (GMT) |
commit | a135c6ff4dcded5661a2321512960b14cf8c15c8 (patch) | |
tree | b0017ecfe702304f592b9d4e8b943784cff26fb2 /3rdParty/Boost/src/boost/range | |
parent | 02d6188ab335e6c62b8341b84579d9549d215118 (diff) | |
download | swift-a135c6ff4dcded5661a2321512960b14cf8c15c8.zip swift-a135c6ff4dcded5661a2321512960b14cf8c15c8.tar.bz2 |
Updated Boost to 1.46.1.
This should hopefuily fix a hang on shutdown on Mac OS X.
Resolves: #782
Release-Notes: Fixed a potential hang on shutdown on Mac OS X.
Diffstat (limited to '3rdParty/Boost/src/boost/range')
-rw-r--r-- | 3rdParty/Boost/src/boost/range/begin.hpp | 23 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/concepts.hpp | 39 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/detail/begin.hpp | 28 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/detail/end.hpp | 37 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/detail/safe_bool.hpp | 72 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/end.hpp | 23 | ||||
-rwxr-xr-x | 3rdParty/Boost/src/boost/range/iterator_range_core.hpp | 34 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/range/size.hpp | 26 |
8 files changed, 219 insertions, 63 deletions
diff --git a/3rdParty/Boost/src/boost/range/begin.hpp b/3rdParty/Boost/src/boost/range/begin.hpp index a4a5e10..c668488 100644 --- a/3rdParty/Boost/src/boost/range/begin.hpp +++ b/3rdParty/Boost/src/boost/range/begin.hpp @@ -91,6 +91,11 @@ namespace range_detail } // namespace 'range_detail' #endif +// Use a ADL namespace barrier to avoid ambiguity with other unqualified +// calls. This is particularly important with C++0x encouraging +// unqualified calls to begin/end. +namespace range_adl_barrier +{ template< class T > inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r ) @@ -114,19 +119,25 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r ) return range_begin( r ); } + } // namespace range_adl_barrier } // namespace boost #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING namespace boost { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type - const_begin( const T& r ) + namespace range_adl_barrier { - return boost::begin( r ); - } -} + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type + const_begin( const T& r ) + { + return boost::range_adl_barrier::begin( r ); + } + } // namespace range_adl_barrier + + using namespace range_adl_barrier; +} // namespace boost #endif diff --git a/3rdParty/Boost/src/boost/range/concepts.hpp b/3rdParty/Boost/src/boost/range/concepts.hpp index 8e4d2cf..5965293 100644 --- a/3rdParty/Boost/src/boost/range/concepts.hpp +++ b/3rdParty/Boost/src/boost/range/concepts.hpp @@ -98,8 +98,9 @@ namespace boost { // classes: // // The Range algorithms often do not require that the iterators are - // Assignable, but the correct standard conformant iterators - // do require the iterators to be a model of the Assignable concept. + // Assignable or default constructable, but the correct standard + // conformant iterators do require the iterators to be a model of the + // Assignable concept. // Iterators that contains a functor that is not assignable therefore // are not correct models of the standard iterator concepts, // despite being adequate for most algorithms. An example of this @@ -141,6 +142,26 @@ namespace boost { BOOST_DEDUCED_TYPENAME SinglePassIteratorConcept::traversal_category, single_pass_traversal_tag >)); + + BOOST_CONCEPT_USAGE(SinglePassIteratorConcept) + { + Iterator i2(++i); + boost::ignore_unused_variable_warning(i2); + + // deliberately we are loose with the postfix version for the single pass + // iterator due to the commonly poor adherence to the specification means that + // many algorithms would be unusable, whereas actually without the check they + // work + (void)(i++); + + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r1(*i); + boost::ignore_unused_variable_warning(r1); + + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r2(*(++i)); + boost::ignore_unused_variable_warning(r2); + } + private: + Iterator i; #endif }; @@ -160,6 +181,20 @@ namespace boost { BOOST_DEDUCED_TYPENAME ForwardIteratorConcept::traversal_category, forward_traversal_tag >)); + + BOOST_CONCEPT_USAGE(ForwardIteratorConcept) + { + // See the above note in the SinglePassIteratorConcept about the handling of the + // postfix increment. Since with forward and better iterators there is no need + // for a proxy, we can sensibly require that the dereference result + // is convertible to reference. + Iterator i2(i++); + boost::ignore_unused_variable_warning(i2); + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r(*(i++)); + boost::ignore_unused_variable_warning(r); + } + private: + Iterator i; #endif }; diff --git a/3rdParty/Boost/src/boost/range/detail/begin.hpp b/3rdParty/Boost/src/boost/range/detail/begin.hpp index 06c2561..f3da732 100644 --- a/3rdParty/Boost/src/boost/range/detail/begin.hpp +++ b/3rdParty/Boost/src/boost/range/detail/begin.hpp @@ -19,9 +19,9 @@ # include <boost/range/value_type.hpp> #endif -namespace boost +namespace boost { - + namespace range_detail { template< typename T > @@ -30,7 +30,7 @@ namespace boost ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin<std_container_> { @@ -40,11 +40,11 @@ namespace boost return c.begin(); }; }; - + ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin<std_pair_> { @@ -54,11 +54,11 @@ namespace boost return p.first; } }; - + ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// - + template<> struct range_begin<array_> { @@ -78,14 +78,16 @@ namespace boost }; } // namespace 'range_detail' - - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type - begin( C& c ) + + namespace range_adl_barrier { - return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type + begin( C& c ) + { + return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); + } } - } // namespace 'boost' diff --git a/3rdParty/Boost/src/boost/range/detail/end.hpp b/3rdParty/Boost/src/boost/range/detail/end.hpp index d6a7368..8b5f35d 100644 --- a/3rdParty/Boost/src/boost/range/detail/end.hpp +++ b/3rdParty/Boost/src/boost/range/detail/end.hpp @@ -24,7 +24,7 @@ # include <boost/range/detail/remove_extent.hpp> # endif -namespace boost +namespace boost { namespace range_detail { @@ -34,39 +34,39 @@ namespace boost ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// - + template<> struct range_end<std_container_> { template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type fun( C& c ) { return c.end(); }; }; - + ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// - + template<> struct range_end<std_pair_> { template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type fun( const P& p ) { return p.second; } }; - + ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// - + template<> - struct range_end<array_> + struct range_end<array_> { #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) template< typename T, std::size_t sz > @@ -82,16 +82,19 @@ namespace boost } #endif }; - + } // namespace 'range_detail' - - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type - end( C& c ) + + namespace range_adl_barrier { - return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); - } - + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type + end( C& c ) + { + return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); + } + } // namespace range_adl_barrier + } // namespace 'boost' # endif // VC6 diff --git a/3rdParty/Boost/src/boost/range/detail/safe_bool.hpp b/3rdParty/Boost/src/boost/range/detail/safe_bool.hpp new file mode 100644 index 0000000..182e510 --- /dev/null +++ b/3rdParty/Boost/src/boost/range/detail/safe_bool.hpp @@ -0,0 +1,72 @@ +// This header intentionally has no include guards. +// +// Copyright (c) 2010 Neil Groves +// 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 +// +// This code utilises the experience gained during the evolution of +// <boost/smart_ptr/operator_bool.hpp> +#ifndef BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP +#define BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP + +#include <boost/config.hpp> +#include <boost/range/config.hpp> + +namespace boost +{ + namespace range_detail + { + +template<class DataMemberPtr> +class safe_bool +{ +public: + typedef safe_bool this_type; + +#if (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570)) || defined(__CINT_) + typedef bool unspecified_bool_type; + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x; + } +#elif defined(_MANAGED) + static void unspecified_bool(this_type***) + { + } + typedef void(*unspecified_bool_type)(this_type***); + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x ? unspecified_bool : 0; + } +#elif \ + ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ + ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ + ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) + + typedef bool (this_type::*unspecified_bool_type)() const; + + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr) + { + return x ? &this_type::detail_safe_bool_member_fn : 0; + } +private: + bool detail_safe_bool_member_fn() const { return false; } +#else + typedef DataMemberPtr unspecified_bool_type; + static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr p) + { + return x ? p : 0; + } +#endif +private: + safe_bool(); + safe_bool(const safe_bool&); + void operator=(const safe_bool&); + ~safe_bool(); +}; + + } // namespace range_detail +} // namespace boost + +#endif // include guard diff --git a/3rdParty/Boost/src/boost/range/end.hpp b/3rdParty/Boost/src/boost/range/end.hpp index 3063c02..d5e6526 100644 --- a/3rdParty/Boost/src/boost/range/end.hpp +++ b/3rdParty/Boost/src/boost/range/end.hpp @@ -88,6 +88,9 @@ namespace range_detail } // namespace 'range_detail' #endif +namespace range_adl_barrier +{ + template< class T > inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r ) { @@ -110,22 +113,24 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r ) return range_end( r ); } + } // namespace range_adl_barrier } // namespace 'boost' - - #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - namespace boost { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type - const_end( const T& r ) + namespace range_adl_barrier { - return boost::end( r ); - } -} + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type + const_end( const T& r ) + { + return boost::range_adl_barrier::end( r ); + } + } // namespace range_adl_barrier + using namespace range_adl_barrier; +} // namespace boost #endif diff --git a/3rdParty/Boost/src/boost/range/iterator_range_core.hpp b/3rdParty/Boost/src/boost/range/iterator_range_core.hpp index 497b1e3..7ef7523 100755 --- a/3rdParty/Boost/src/boost/range/iterator_range_core.hpp +++ b/3rdParty/Boost/src/boost/range/iterator_range_core.hpp @@ -27,6 +27,7 @@ #include <boost/range/iterator.hpp> #include <boost/range/difference_type.hpp> #include <boost/range/algorithm/equal.hpp> +#include <boost/range/detail/safe_bool.hpp> #include <boost/utility/enable_if.hpp> #include <iterator> #include <algorithm> @@ -81,7 +82,6 @@ namespace boost struct range_tag { }; struct const_range_tag { }; - } // iterator range template class -----------------------------------------// @@ -106,13 +106,14 @@ namespace boost template<class IteratorT> class iterator_range { + typedef range_detail::safe_bool< IteratorT iterator_range<IteratorT>::* > safe_bool_t; protected: // Used by sub_range //! implementation class typedef iterator_range_detail::iterator_range_impl<IteratorT> impl; public: - //! this type typedef iterator_range<IteratorT> type; + typedef BOOST_DEDUCED_TYPENAME safe_bool_t::unspecified_bool_type unspecified_bool_type; //BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(value_type); //! Encapsulated value type @@ -230,7 +231,7 @@ namespace boost difference_type size() const { - return m_End - m_Begin; + return m_End - m_Begin; } bool empty() const @@ -238,18 +239,15 @@ namespace boost return m_Begin == m_End; } -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - operator bool() const + operator unspecified_bool_type() const { - return !empty(); + return safe_bool_t::to_unspecified_bool(m_Begin != m_End, &iterator_range::m_Begin); } -#else - typedef iterator (iterator_range::*unspecified_bool_type) () const; - operator unspecified_bool_type() const + + bool operator!() const { - return empty() ? 0: &iterator_range::end; + return empty(); } -#endif bool equal( const iterator_range& r ) const { @@ -290,6 +288,20 @@ namespace boost return *--last; } + // pop_front() - added to model the SinglePassRangePrimitiveConcept + void pop_front() + { + BOOST_ASSERT( !empty() ); + ++m_Begin; + } + + // pop_back() - added to model the BidirectionalRangePrimitiveConcept + void pop_back() + { + BOOST_ASSERT( !empty() ); + --m_End; + } + reference operator[]( difference_type at ) const { BOOST_ASSERT( at >= 0 && at < size() ); diff --git a/3rdParty/Boost/src/boost/range/size.hpp b/3rdParty/Boost/src/boost/range/size.hpp index 2b572d4..4b4eebe 100644 --- a/3rdParty/Boost/src/boost/range/size.hpp +++ b/3rdParty/Boost/src/boost/range/size.hpp @@ -15,6 +15,7 @@ # pragma once #endif +#include <boost/range/config.hpp> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> #include <boost/range/difference_type.hpp> @@ -22,13 +23,28 @@ namespace boost { + namespace range_detail + { + template<class SinglePassRange> + inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type + range_calculate_size(const SinglePassRange& rng) + { + BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 && + "reachability invariant broken!" ); + return boost::end(rng) - boost::begin(rng); + } + } - template< class T > - inline BOOST_DEDUCED_TYPENAME range_difference<T>::type size( const T& r ) + template<class SinglePassRange> + inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type + size(const SinglePassRange& rng) { - BOOST_ASSERT( (boost::end( r ) - boost::begin( r )) >= 0 && - "reachability invariant broken!" ); - return boost::end( r ) - boost::begin( r ); +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ + !BOOST_WORKAROUND(__GNUC__, < 3) \ + /**/ + using namespace range_detail; +#endif + return range_calculate_size(rng); } } // namespace 'boost' |