Skip to content

Commit

Permalink
Remove BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
Browse files Browse the repository at this point in the history
Correct static_assert messages.
Fix messages & replace is_standard_layout with is_copy_constructible.
  • Loading branch information
gogagum committed Jan 19, 2025
1 parent 39815e4 commit 367f73c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 44 deletions.
5 changes: 0 additions & 5 deletions include/boost/iterator/detail/config_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@

#endif


#if !defined(BOOST_MSVC) && (defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE))
# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#endif

# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))

// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion
Expand Down
1 change: 0 additions & 1 deletion include/boost/iterator/detail/config_undef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#undef BOOST_NO_IS_CONVERTIBLE
#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE
#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#undef BOOST_NO_LVALUE_RETURN_DETECTION
#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP

Expand Down
31 changes: 1 addition & 30 deletions include/boost/iterator/iterator_facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,7 @@ namespace iterators {
struct use_operator_brackets_proxy
: detail::negation<
detail::conjunction<
// Really we want an is_copy_constructible trait here,
// but is_POD will have to suffice in the meantime.
std::is_standard_layout<ValueType>
std::is_copy_constructible<ValueType>
, std::is_trivial<ValueType>
, iterator_writability_disabled<ValueType,Reference>
>
Expand Down Expand Up @@ -497,17 +495,6 @@ namespace iterators {


// Macros which describe the declarations of binary operators
# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
template < \
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
, class Derived2, class V2, class TC2, class Reference2, class Difference2 \
> \
prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \
operator op( \
iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
# else
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
template < \
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
Expand All @@ -520,7 +507,6 @@ namespace iterators {
operator op( \
iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
# endif

# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable)
Expand Down Expand Up @@ -931,11 +917,6 @@ namespace iterators {
# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \
BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \
{ \
/* For those compilers that do not support enable_if */ \
static_assert( \
is_interoperable<Derived1, Derived2>::value, \
"Derived1 & Derived2 types must be interoperable." \
); \
return_prefix iterator_core_access::base_op( \
*static_cast<Derived1 const*>(&lhs) \
, *static_cast<Derived2 const*>(&rhs) \
Expand All @@ -961,16 +942,6 @@ namespace iterators {
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \
{ \
using boost::iterators::detail::is_traversal_at_least; \
typedef typename iterator_category<Derived1>::type Derived1IterCat; \
typedef typename iterator_category<Derived2>::type Derived2IterCat; \
/* For those compilers that do not support enable_if */ \
static_assert( \
is_interoperable<Derived1, Derived2>::value && \
is_traversal_at_least<Derived1IterCat, random_access_traversal_tag>::value && \
is_traversal_at_least<Derived2IterCat, random_access_traversal_tag>::value, \
"Derived1 & Derived2 types must be interoperable and must both have " \
"random_access_traversal_tag." \
); \
return_prefix iterator_core_access::base_op( \
*static_cast<Derived1 const*>(&lhs) \
, *static_cast<Derived2 const*>(&rhs) \
Expand Down
2 changes: 1 addition & 1 deletion include/boost/iterator/minimum_category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct minimum_category_impl<true,true>
{
static_assert(
std::is_same<T1,T2>::value,
"Types must be same when they are convertible to each other."
"Iterator category types must be the same when they are equivalent."
);
typedef T1 type;
};
Expand Down
9 changes: 4 additions & 5 deletions include/boost/iterator/new_iterator_tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ void constant_lvalue_iterator_test(Iterator i, T v1) {
const T &v2 = *i2;
BOOST_TEST(v1 == v2);
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
static_assert(is_lvalue_iterator<Iterator>::value,
"Iterator must be lvalue.");
static_assert(!is_non_const_lvalue_iterator<Iterator>::value,
"Iterator must be const.");
static_assert(is_lvalue_iterator<Iterator>::value
&& !is_non_const_lvalue_iterator<Iterator>::value,
"Iterator must be a const lvalue iterator.");
#endif
}

Expand All @@ -149,7 +148,7 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) {
BOOST_TEST(v2 == v4);
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
static_assert(is_lvalue_iterator<Iterator>::value,
"Iterator must be lvalue.");
"Iterator must be an lvalue iterator.");
static_assert(is_non_const_lvalue_iterator<Iterator>::value,
"Iterator must be non-const.");
#endif
Expand Down
4 changes: 2 additions & 2 deletions test/indirect_iter_member_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main()

static_assert(std::is_convertible<Iter::iterator_category,
std::random_access_iterator_tag>::value,
"Iter must have an STL random_access_iterator_tag.");
"Iter must have a random access category.");
static_assert(std::is_convertible<boost::iterator_traversal<Iter>::type,
boost::random_access_traversal_tag>::value,
"Iter must have a random_access_traversal_tag.");
Expand Down Expand Up @@ -73,7 +73,7 @@ int main()

static_assert(std::is_convertible<Iter::iterator_category,
std::random_access_iterator_tag>::value,
"Iter must have an STL random_access_iterator_tag.");
"Iter must have a random access category.");
static_assert(std::is_convertible<boost::iterator_traversal<Iter>::type,
boost::random_access_traversal_tag>::value,
"Iter must have a random_access_traversal_tag.");
Expand Down

0 comments on commit 367f73c

Please sign in to comment.