1 | --- D:/boost_1_47_0/boost/iterator/iterator_facade.old.hpp Wed Jul 6 21:57:37 2011
|
---|
2 | +++ D:/boost_1_47_0/boost/iterator/iterator_facade.new.hpp Thu Jul 14 14:28:45 2011
|
---|
3 | @@ -294,46 +294,43 @@
|
---|
4 |
|
---|
5 | // operator->() needs special support for input iterators to strictly meet the
|
---|
6 | // standard's requirements. If *i is not a reference type, we must still
|
---|
7 | - // produce a lvalue to which a pointer can be formed. We do that by
|
---|
8 | - // returning an instantiation of this special proxy class template.
|
---|
9 | - template <class T>
|
---|
10 | - struct operator_arrow_proxy
|
---|
11 | + // produce a lvalue to which a pointer can be formed. We do that by
|
---|
12 | + // returning a proxy object containing an instance of the reference object.
|
---|
13 | + template <class Reference, class Pointer>
|
---|
14 | + struct operator_arrow_dispatch // proxy references
|
---|
15 | {
|
---|
16 | - operator_arrow_proxy(T const* px) : m_value(*px) {}
|
---|
17 | - T* operator->() const { return &m_value; }
|
---|
18 | - // This function is needed for MWCW and BCC, which won't call operator->
|
---|
19 | - // again automatically per 13.3.1.2 para 8
|
---|
20 | - operator T*() const { return &m_value; }
|
---|
21 | - mutable T m_value;
|
---|
22 | + struct proxy
|
---|
23 | + {
|
---|
24 | + explicit proxy(Reference const & x) : m_ref(x) {}
|
---|
25 | + Reference const * operator->() const { return &m_ref; }
|
---|
26 | + // This function is needed for MWCW and BCC, which won't call
|
---|
27 | + // operator-> again automatically per 13.3.1.2 para 8
|
---|
28 | + operator Reference const *() const { return &m_ref; }
|
---|
29 | + Reference const m_ref;
|
---|
30 | + };
|
---|
31 | + typedef proxy result_type;
|
---|
32 | + static result_type apply(Reference const & x)
|
---|
33 | + {
|
---|
34 | + return result_type(x);
|
---|
35 | + }
|
---|
36 | };
|
---|
37 |
|
---|
38 | - // A metafunction that gets the result type for operator->. Also
|
---|
39 | - // has a static function make() which builds the result from a
|
---|
40 | - // Reference
|
---|
41 | - template <class ValueType, class Reference, class Pointer>
|
---|
42 | - struct operator_arrow_result
|
---|
43 | + template <class T, class Pointer>
|
---|
44 | + struct operator_arrow_dispatch<T&, Pointer> // "real" references
|
---|
45 | {
|
---|
46 | - // CWPro8.3 won't accept "operator_arrow_result::type", and we
|
---|
47 | - // need that type below, so metafunction forwarding would be a
|
---|
48 | - // losing proposition here.
|
---|
49 | - typedef typename mpl::if_<
|
---|
50 | - is_reference<Reference>
|
---|
51 | - , Pointer
|
---|
52 | - , operator_arrow_proxy<ValueType>
|
---|
53 | - >::type type;
|
---|
54 | -
|
---|
55 | - static type make(Reference x)
|
---|
56 | + typedef Pointer result_type;
|
---|
57 | + static result_type apply(T& x)
|
---|
58 | {
|
---|
59 | - return boost::implicit_cast<type>(&x);
|
---|
60 | + return boost::implicit_cast<result_type>(&x);
|
---|
61 | }
|
---|
62 | };
|
---|
63 |
|
---|
64 | # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
---|
65 | // Deal with ETI
|
---|
66 | template<>
|
---|
67 | - struct operator_arrow_result<int, int, int>
|
---|
68 | + struct operator_arrow_dispatch<int, int>
|
---|
69 | {
|
---|
70 | - typedef int type;
|
---|
71 | + typedef int result_type;
|
---|
72 | };
|
---|
73 | # endif
|
---|
74 |
|
---|
75 | @@ -618,11 +615,10 @@
|
---|
76 | Value, CategoryOrTraversal, Reference, Difference
|
---|
77 | > associated_types;
|
---|
78 |
|
---|
79 | - typedef boost::detail::operator_arrow_result<
|
---|
80 | - typename associated_types::value_type
|
---|
81 | - , Reference
|
---|
82 | + typedef boost::detail::operator_arrow_dispatch<
|
---|
83 | + Reference
|
---|
84 | , typename associated_types::pointer
|
---|
85 | - > pointer_;
|
---|
86 | + > operator_arrow_dispatch_;
|
---|
87 |
|
---|
88 | protected:
|
---|
89 | // For use by derived classes
|
---|
90 | @@ -634,7 +630,7 @@
|
---|
91 | typedef Reference reference;
|
---|
92 | typedef Difference difference_type;
|
---|
93 |
|
---|
94 | - typedef typename pointer_::type pointer;
|
---|
95 | + typedef typename operator_arrow_dispatch_::result_type pointer;
|
---|
96 |
|
---|
97 | typedef typename associated_types::iterator_category iterator_category;
|
---|
98 |
|
---|
99 | @@ -645,7 +641,7 @@
|
---|
100 |
|
---|
101 | pointer operator->() const
|
---|
102 | {
|
---|
103 | - return pointer_::make(*this->derived());
|
---|
104 | + return operator_arrow_dispatch_::apply(*this->derived());
|
---|
105 | }
|
---|
106 |
|
---|
107 | typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
|
---|