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