RE: [boost] Re: counting_iterator_test.hpp fails on aC++

Sorry. This is the correct version of the new static assertion. // workaround for aC++ CR JAGaf33512 # define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ iterator_adaptor_assert_traversal<my_traversal, cat>(); // typedef int assertion[sizeof(detail::static_assert_convertible_to<cat>(my_traversal( )))]; -Jerry -----Original Message----- From: DY, JERRY U (SBCSI) Sent: Tuesday, July 27, 2004 12:54 PM To: 'boost@lists.boost.org' Subject: RE: [boost] Re: counting_iterator_test.hpp fails on aC++ Dave, As you suggested, an auxiliary function template is defined (outside of the iterator_adaptor class - aC++ doesn't like it if it's a member function): // workaround for aC++ CR JAGaf33512 template <typename TR1, typename TR2> inline void iterator_adaptor_assert_traversal () { typedef int assertion[sizeof(detail::static_assert_convertible_to<TR2>(TR1()))]; } Then the old static assertion is replaced like so: # define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ iterator_adaptor_assert_traversal<my_traversal, random_access_traversal_tag>(); // typedef iterator_adaptor_assert_traversal<my_traversal, cat> assert_traversal_t; I tested this by adapting an ordinary pointer to a forward traversal iterator and if the program calls the operator+= (calling the adaptor's advance member function and triggering the static assertion), the compile fails, the compile succeeds otherwise. There should be no additional overhead incurred due to the workaround because the function itself is inlined and all it does is a typedef. Is this workaround acceptable for check-in? Thanks! -Jerry

"DY, JERRY U \(SBCSI\)" <jd2419@sbc.com> writes:
Sorry. This is the correct version of the new static assertion.
// workaround for aC++ CR JAGaf33512 # define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ iterator_adaptor_assert_traversal<my_traversal, cat>(); // typedef int assertion[sizeof(detail::static_assert_convertible_to<cat>(my_traversal( )))];
-Jerry
Please post a patch as an attachment. I don't know how to evaluate this otherwise (especially not during my vacation ;->). -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
David Abrahams
-
DY, JERRY U (SBCSI)