ext/boost/iterator/transform_iterator.hpp in passenger-3.0.21 vs ext/boost/iterator/transform_iterator.hpp in passenger-3.9.1.beta
- old
+ new
@@ -18,11 +18,13 @@
#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>
@@ -33,37 +35,20 @@
template <class UnaryFunction, class Iterator, class Reference = use_default, class Value = use_default>
class transform_iterator;
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<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
@@ -111,10 +96,10 @@
// function pointer type, since it will be 0. Too dangerous.
BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
#endif
}
- template<
+ template <
class OtherUnaryFunction
, class OtherIterator
, class OtherReference
, class OtherValue>
transform_iterator(