1 | // (C) Copyright David Abrahams 2002. |
---|
2 | // (C) Copyright Jeremy Siek 2002. |
---|
3 | // (C) Copyright Thomas Witt 2002. |
---|
4 | // Distributed under the Boost Software License, Version 1.0. (See |
---|
5 | // accompanying file LICENSE_1_0.txt or copy at |
---|
6 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | |
---|
8 | // no include guard multiple inclusion intended |
---|
9 | |
---|
10 | // |
---|
11 | // This is a temporary workaround until the bulk of this is |
---|
12 | // available in boost config. |
---|
13 | // 23/02/03 thw |
---|
14 | // |
---|
15 | |
---|
16 | #include <boost/config.hpp> // for prior |
---|
17 | #include <boost/detail/workaround.hpp> |
---|
18 | |
---|
19 | #ifdef BOOST_ITERATOR_CONFIG_DEF |
---|
20 | # error you have nested config_def #inclusion. |
---|
21 | #else |
---|
22 | # define BOOST_ITERATOR_CONFIG_DEF |
---|
23 | #endif |
---|
24 | |
---|
25 | // We enable this always now. Otherwise, the simple case in |
---|
26 | // libs/iterator/test/constant_iterator_arrow.cpp fails to compile |
---|
27 | // because the operator-> return is improperly deduced as a non-const |
---|
28 | // pointer. |
---|
29 | #if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
---|
30 | || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) |
---|
31 | |
---|
32 | // Recall that in general, compilers without partial specialization |
---|
33 | // can't strip constness. Consider counting_iterator, which normally |
---|
34 | // passes a const Value to iterator_facade. As a result, any code |
---|
35 | // which makes a std::vector of the iterator's value_type will fail |
---|
36 | // when its allocator declares functions overloaded on reference and |
---|
37 | // const_reference (the same type). |
---|
38 | // |
---|
39 | // Furthermore, Borland 5.5.1 drops constness in enough ways that we |
---|
40 | // end up using a proxy for operator[] when we otherwise shouldn't. |
---|
41 | // Using reference constness gives it an extra hint that it can |
---|
42 | // return the value_type from operator[] directly, but is not |
---|
43 | // strictly necessary. Not sure how best to resolve this one. |
---|
44 | |
---|
45 | # define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1 |
---|
46 | |
---|
47 | #endif |
---|
48 | |
---|
49 | #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ |
---|
50 | || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ |
---|
51 | || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ |
---|
52 | || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) |
---|
53 | # define BOOST_NO_LVALUE_RETURN_DETECTION |
---|
54 | |
---|
55 | # if 0 // test code |
---|
56 | struct v {}; |
---|
57 | |
---|
58 | typedef char (&no)[3]; |
---|
59 | |
---|
60 | template <class T> |
---|
61 | no foo(T const&, ...); |
---|
62 | |
---|
63 | template <class T> |
---|
64 | char foo(T&, int); |
---|
65 | |
---|
66 | |
---|
67 | struct value_iterator |
---|
68 | { |
---|
69 | v operator*() const; |
---|
70 | }; |
---|
71 | |
---|
72 | template <class T> |
---|
73 | struct lvalue_deref_helper |
---|
74 | { |
---|
75 | static T& x; |
---|
76 | enum { value = (sizeof(foo(*x,0)) == 1) }; |
---|
77 | }; |
---|
78 | |
---|
79 | int z2[(lvalue_deref_helper<v*>::value == 1) ? 1 : -1]; |
---|
80 | int z[(lvalue_deref_helper<value_iterator>::value) == 1 ? -1 : 1 ]; |
---|
81 | # endif |
---|
82 | |
---|
83 | #endif |
---|
84 | |
---|
85 | #if BOOST_WORKAROUND(__MWERKS__, <=0x2407) |
---|
86 | # define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" |
---|
87 | #endif |
---|
88 | |
---|
89 | #if BOOST_WORKAROUND(__GNUC__, == 2) \ |
---|
90 | || BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ |
---|
91 | || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) |
---|
92 | # define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: |
---|
93 | |
---|
94 | # if 0 // test code |
---|
95 | #include <boost/type_traits/is_convertible.hpp> |
---|
96 | template <class T> |
---|
97 | struct foo |
---|
98 | { |
---|
99 | foo(T); |
---|
100 | |
---|
101 | template <class U> |
---|
102 | foo(foo<U> const& other) : p(other.p) { } |
---|
103 | |
---|
104 | T p; |
---|
105 | }; |
---|
106 | |
---|
107 | bool x = boost::is_convertible<foo<int const*>, foo<int*> >::value; |
---|
108 | # endif |
---|
109 | |
---|
110 | #endif |
---|
111 | |
---|
112 | #if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ |
---|
113 | || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \ |
---|
114 | || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) |
---|
115 | # define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" |
---|
116 | #endif |
---|
117 | |
---|
118 | #if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) |
---|
119 | # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY |
---|
120 | #endif |
---|
121 | |
---|
122 | # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) |
---|
123 | # define BOOST_ARG_DEPENDENT_TYPENAME typename |
---|
124 | # else |
---|
125 | # define BOOST_ARG_DEPENDENT_TYPENAME |
---|
126 | # endif |
---|
127 | |
---|
128 | # if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \ |
---|
129 | || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) |
---|
130 | |
---|
131 | // GCC-2.95 eagerly instantiates templated constructors and conversion |
---|
132 | // operators in convertibility checks, causing premature errors. |
---|
133 | // |
---|
134 | // Borland's problems are harder to diagnose due to lack of an |
---|
135 | // instantiation stack backtrace. They may be due in part to the fact |
---|
136 | // that it drops cv-qualification willy-nilly in templates. |
---|
137 | # define BOOST_NO_ONE_WAY_ITERATOR_INTEROP |
---|
138 | # endif |
---|
139 | |
---|
140 | // no include guard; multiple inclusion intended |
---|