config_def.hpp 4.4 KB

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