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