Ticket #1427: patch_transform_iterator

File patch_transform_iterator, 2.0 KB (added by debionne@…, 13 years ago)

transform_iterator.hpp patch for boost 1.39

Line 
1--- D:/users/debionne/dev/boost/clean/boost_1_39_0/boost/iterator/transform_iterator.hpp Sun Nov 25 20:07:19 2007
2+++ D:/users/debionne/dev/boost/boost_1_39_0/boost/iterator/transform_iterator.hpp Fri Jul 31 10:38:40 2009
3@@ -21,6 +21,8 @@
4 #include <boost/type_traits/is_reference.hpp>
5 #include <boost/type_traits/remove_const.hpp>
6 #include <boost/type_traits/remove_reference.hpp>
7+#include <boost/utility/result_of.hpp>
8+
9
10 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
11 # include <boost/type_traits/is_base_and_derived.hpp>
12@@ -36,33 +38,18 @@
13
14 namespace detail
15 {
16-
17- template <class UnaryFunc>
18- struct function_object_result
19- {
20- typedef typename UnaryFunc::result_type type;
21- };
22-
23-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
24- template <class Return, class Argument>
25- struct function_object_result<Return(*)(Argument)>
26- {
27- typedef Return type;
28- };
29-#endif
30-
31 // Compute the iterator_adaptor instantiation to be used for transform_iterator
32 template <class UnaryFunc, class Iterator, class Reference, class Value>
33 struct transform_iterator_base
34 {
35 private:
36+ typedef typename std::iterator_traits<Iterator>::reference Arg1;
37+
38 // By default, dereferencing the iterator yields the same as
39- // the function. Do we need to adjust the way
40- // function_object_result is computed for the standard
41- // proposal (e.g. using Doug's result_of)?
42+ // the function.
43 typedef typename ia_dflt_help<
44 Reference
45- , function_object_result<UnaryFunc>
46+ , result_of<UnaryFunc(typename std::iterator_traits<Iterator>::value_type)>
47 >::type reference;
48
49 // To get the default for Value: remove any reference on the
50@@ -114,7 +101,7 @@
51 #endif
52 }
53
54- template<
55+ template <
56 class OtherUnaryFunction
57 , class OtherIterator
58 , class OtherReference