diff options
Diffstat (limited to '3rdParty/Boost/src/boost/iterator')
5 files changed, 174 insertions, 64 deletions
diff --git a/3rdParty/Boost/src/boost/iterator/filter_iterator.hpp b/3rdParty/Boost/src/boost/iterator/filter_iterator.hpp new file mode 100644 index 0000000..14d640b --- /dev/null +++ b/3rdParty/Boost/src/boost/iterator/filter_iterator.hpp @@ -0,0 +1,135 @@ +// (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_FILTER_ITERATOR_23022003THW_HPP +#define BOOST_FILTER_ITERATOR_23022003THW_HPP + +#include <boost/iterator.hpp> +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_categories.hpp> + +#include <boost/type_traits/is_class.hpp> +#include <boost/static_assert.hpp> + +namespace boost +{ + template <class Predicate, class Iterator> + class filter_iterator; + + namespace detail + { + template <class Predicate, class Iterator> + struct filter_iterator_base + { + typedef iterator_adaptor< + filter_iterator<Predicate, Iterator> + , Iterator + , use_default + , typename mpl::if_< + is_convertible< + typename iterator_traversal<Iterator>::type + , random_access_traversal_tag + > + , bidirectional_traversal_tag + , use_default + >::type + > type; + }; + } + + template <class Predicate, class Iterator> + class filter_iterator + : public detail::filter_iterator_base<Predicate, Iterator>::type + { + typedef typename detail::filter_iterator_base< + Predicate, Iterator + >::type super_t; + + friend class iterator_core_access; + + public: + filter_iterator() { } + + filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(f), m_end(end_) + { + satisfy_predicate(); + } + + filter_iterator(Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(), m_end(end_) + { + // Pro8 is a little too aggressive about instantiating the + // body of this function. +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + // Don't allow use of this constructor if Predicate is a + // function pointer type, since it will be 0. + BOOST_STATIC_ASSERT(is_class<Predicate>::value); +#endif + satisfy_predicate(); + } + + template<class OtherIterator> + filter_iterator( + filter_iterator<Predicate, OtherIterator> const& t + , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 + ) + : super_t(t.base()), m_predicate(t.predicate()), m_end(t.end()) {} + + Predicate predicate() const { return m_predicate; } + + Iterator end() const { return m_end; } + + private: + void increment() + { + ++(this->base_reference()); + satisfy_predicate(); + } + + void decrement() + { + while(!this->m_predicate(*--(this->base_reference()))){}; + } + + void satisfy_predicate() + { + while (this->base() != this->m_end && !this->m_predicate(*this->base())) + ++(this->base_reference()); + } + + // Probably should be the initial base class so it can be + // optimized away via EBO if it is an empty class. + Predicate m_predicate; + Iterator m_end; + }; + + template <class Predicate, class Iterator> + filter_iterator<Predicate,Iterator> + make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) + { + return filter_iterator<Predicate,Iterator>(f,x,end); + } + + template <class Predicate, class Iterator> + filter_iterator<Predicate,Iterator> + make_filter_iterator( + typename iterators::enable_if< + is_class<Predicate> + , Iterator + >::type x + , Iterator end = Iterator() +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + , Predicate* = 0 +#endif + ) + { + return filter_iterator<Predicate,Iterator>(x,end); + } + +} // namespace boost + +#endif // BOOST_FILTER_ITERATOR_23022003THW_HPP diff --git a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp index 27b08ff..9f2fbb0 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp @@ -24,15 +24,9 @@ #ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY # include <boost/type_traits/remove_reference.hpp> - -# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) -# include <boost/type_traits/add_reference.hpp> -# endif - -#else -# include <boost/type_traits/add_reference.hpp> #endif +#include <boost/type_traits/add_reference.hpp> #include <boost/iterator/detail/config_def.hpp> #include <boost/iterator/iterator_traits.hpp> diff --git a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp index 5ee73b5..d84b402 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp @@ -14,8 +14,8 @@ #include <boost/iterator/detail/facade_iterator_category.hpp> #include <boost/iterator/detail/enable_if.hpp> -#include <boost/implicit_cast.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> @@ -147,7 +147,7 @@ namespace boost // Returning a mutable reference allows nonsense like // (*r++).mutate(), but it imposes fewer assumptions about the - // behavior of the value_type. In particular, recall taht + // behavior of the value_type. In particular, recall that // (*r).mutate() is legal if operator* returns by value. value_type& operator*() const @@ -294,46 +294,43 @@ namespace boost // 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 a lvalue to which a pointer can be formed. We do that by - // returning an instantiation of this special proxy class template. - template <class T> - struct operator_arrow_proxy + // 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 { - operator_arrow_proxy(T const* px) : m_value(*px) {} - T* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 - operator T*() const { return &m_value; } - mutable T m_value; + 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); + } }; - // A metafunction that gets the result type for operator->. Also - // has a static function make() which builds the result from a - // Reference - template <class ValueType, class Reference, class Pointer> - struct operator_arrow_result + template <class T, class Pointer> + struct operator_arrow_dispatch<T&, Pointer> // "real" references { - // CWPro8.3 won't accept "operator_arrow_result::type", and we - // need that type below, so metafunction forwarding would be a - // losing proposition here. - typedef typename mpl::if_< - is_reference<Reference> - , Pointer - , operator_arrow_proxy<ValueType> - >::type type; - - static type make(Reference x) + typedef Pointer result_type; + static result_type apply(T& x) { - return boost::implicit_cast<type>(&x); + return boost::addressof(x); } }; # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Deal with ETI template<> - struct operator_arrow_result<int, int, int> + struct operator_arrow_dispatch<int, int> { - typedef int type; + typedef int result_type; }; # endif @@ -618,11 +615,10 @@ namespace boost Value, CategoryOrTraversal, Reference, Difference > associated_types; - typedef boost::detail::operator_arrow_result< - typename associated_types::value_type - , Reference + typedef boost::detail::operator_arrow_dispatch< + Reference , typename associated_types::pointer - > pointer_; + > operator_arrow_dispatch_; protected: // For use by derived classes @@ -634,7 +630,7 @@ namespace boost typedef Reference reference; typedef Difference difference_type; - typedef typename pointer_::type pointer; + typedef typename operator_arrow_dispatch_::result_type pointer; typedef typename associated_types::iterator_category iterator_category; @@ -645,7 +641,7 @@ namespace boost pointer operator->() const { - return pointer_::make(*this->derived()); + return operator_arrow_dispatch_::apply(*this->derived()); } typename boost::detail::operator_brackets_result<Derived,Value,reference>::type diff --git a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp index 97b6b48..79cc7f2 100644 --- a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp @@ -7,8 +7,8 @@ #ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP #define BOOST_REVERSE_ITERATOR_23022003THW_HPP +#include <boost/next_prior.hpp> #include <boost/iterator.hpp> -#include <boost/utility.hpp> #include <boost/iterator/iterator_adaptor.hpp> namespace boost diff --git a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp index c365fe0..b79a440 100644 --- a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp @@ -20,6 +20,8 @@ #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> @@ -35,33 +37,16 @@ namespace boost namespace detail { - - template <class UnaryFunc> - struct function_object_result - { - typedef typename UnaryFunc::result_type type; - }; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Return, class Argument> - struct function_object_result<Return(*)(Argument)> - { - typedef Return type; - }; -#endif - // 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. Do we need to adjust the way - // function_object_result is computed for the standard - // proposal (e.g. using Doug's result_of)? + // the function. typedef typename ia_dflt_help< Reference - , function_object_result<UnaryFunc> + , result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)> >::type reference; // To get the default for Value: remove any reference on the @@ -113,7 +98,7 @@ namespace boost #endif } - template< + template < class OtherUnaryFunction , class OtherIterator , class OtherReference |