blob: f4af926ae7022f8175c70ff6246eecec590106af [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// (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 <ndnboost/config.hpp> // for prior
17#include <ndnboost/detail/workaround.hpp>
18
Jeff Thompson3d613fd2013-10-15 15:39:04 -070019#ifdef NDNBOOST_ITERATOR_CONFIG_DEF
Jeff Thompsona28eed82013-08-22 16:21:10 -070020# error you have nested config_def #inclusion.
21#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070022# define NDNBOOST_ITERATOR_CONFIG_DEF
Jeff Thompsona28eed82013-08-22 16:21:10 -070023#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.
Jeff Thompson3d613fd2013-10-15 15:39:04 -070029#if 1 || defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
30 || NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x531))
Jeff Thompsona28eed82013-08-22 16:21:10 -070031
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045# define NDNBOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1
Jeff Thompsona28eed82013-08-22 16:21:10 -070046
47#endif
48
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, <= 1300) \
50 || NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x5A0)) \
51 || (NDNBOOST_WORKAROUND(NDNBOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
52 || NDNBOOST_WORKAROUND(__DECCXX_VER, NDNBOOST_TESTED_AT(60590042)) \
53 || NDNBOOST_WORKAROUND(__SUNPRO_CC, NDNBOOST_TESTED_AT(0x590))
Jeff Thompsona28eed82013-08-22 16:21:10 -070054
Jeff Thompson3d613fd2013-10-15 15:39:04 -070055# define NDNBOOST_NO_LVALUE_RETURN_DETECTION
Jeff Thompsona28eed82013-08-22 16:21:10 -070056
57# if 0 // test code
58 struct v {};
59
60 typedef char (&no)[3];
61
62 template <class T>
63 no foo(T const&, ...);
64
65 template <class T>
66 char foo(T&, int);
67
68
69 struct value_iterator
70 {
71 v operator*() const;
72 };
73
74 template <class T>
75 struct lvalue_deref_helper
76 {
77 static T& x;
78 enum { value = (sizeof(foo(*x,0)) == 1) };
79 };
80
81 int z2[(lvalue_deref_helper<v*>::value == 1) ? 1 : -1];
82 int z[(lvalue_deref_helper<value_iterator>::value) == 1 ? -1 : 1 ];
83# endif
84
85#endif
86
Jeff Thompson3d613fd2013-10-15 15:39:04 -070087#if NDNBOOST_WORKAROUND(__MWERKS__, <=0x2407)
88# define NDNBOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types"
Jeff Thompsona28eed82013-08-22 16:21:10 -070089#endif
90
Jeff Thompson3d613fd2013-10-15 15:39:04 -070091#if NDNBOOST_WORKAROUND(__GNUC__, == 2) \
92 || NDNBOOST_WORKAROUND(__GNUC__, == 3) && NDNBOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \
93 || NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x551))
94# define NDNBOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile:
Jeff Thompsona28eed82013-08-22 16:21:10 -070095
96# if 0 // test code
97 #include <ndnboost/type_traits/is_convertible.hpp>
98 template <class T>
99 struct foo
100 {
101 foo(T);
102
103 template <class U>
104 foo(foo<U> const& other) : p(other.p) { }
105
106 T p;
107 };
108
109 bool x = ndnboost::is_convertible<foo<int const*>, foo<int*> >::value;
110# endif
111
112#endif
113
114
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700115#if !defined(NDNBOOST_MSVC) && (defined(NDNBOOST_NO_SFINAE) || defined(NDNBOOST_NO_IS_CONVERTIBLE) || defined(NDNBOOST_NO_IS_CONVERTIBLE_TEMPLATE))
116# define NDNBOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
Jeff Thompsona28eed82013-08-22 16:21:10 -0700117#endif
118
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700119# if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, <= 1300)
120# define NDNBOOST_ARG_DEPENDENT_TYPENAME typename
Jeff Thompsona28eed82013-08-22 16:21:10 -0700121# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700122# define NDNBOOST_ARG_DEPENDENT_TYPENAME
Jeff Thompsona28eed82013-08-22 16:21:10 -0700123# endif
124
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700125# if NDNBOOST_WORKAROUND(__GNUC__, == 2) && NDNBOOST_WORKAROUND(__GNUC_MINOR__, NDNBOOST_TESTED_AT(95)) \
126 || NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x564))
Jeff Thompsona28eed82013-08-22 16:21:10 -0700127
128// GCC-2.95 eagerly instantiates templated constructors and conversion
129// operators in convertibility checks, causing premature errors.
130//
131// Borland's problems are harder to diagnose due to lack of an
132// instantiation stack backtrace. They may be due in part to the fact
133// that it drops cv-qualification willy-nilly in templates.
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700134# define NDNBOOST_NO_ONE_WAY_ITERATOR_INTEROP
Jeff Thompsona28eed82013-08-22 16:21:10 -0700135# endif
136
137// no include guard; multiple inclusion intended