From abf5a45b0901af2c1a925d1f4c94c53681a5c20f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?=
BOOST_VERIFY
BOOST_VERIFY_MSG
+ BOOST_ASSERT_IS_VOID
BOOST_ASSERT_MSG(expr,msg) when it's not.
+
The macro BOOST_ASSERT_IS_VOID is defined when BOOST_ASSERT and BOOST_ASSERT_MSG, are expanded to ((void)0).
+ This macro is useful to avoid compiling and potentially running code that is only intended to prepare data to be used in the assertion.
+
+void MyContainer::erase(iterator i)
+{
+ //Some sanity checks, data must be ordered
+ #ifndef BOOST_ASSERT_IS_EMPTY
+ if(i != c.begin()){
+ iterator prev = i;
+ --prev;
+ BOOST_ASSERT(*prev < *i);
+ }
+ else if(i != c.end()){
+ iterator next = i;
+ ++next;
+ BOOST_ASSERT(*i < *next);
+ }
+ #endif
+ this->erase_impl(i);
+}
+
+
+
+
+ • By default, BOOST_ASSERT_IS_VOID is defined if NDEBUG is defined.
• If the macro BOOST_DISABLE_ASSERTS is defined BOOST_ASSERT_IS_VOID is always defined.
• If the macro BOOST_ENABLE_ASSERT_HANDLER is defined BOOST_ASSERT_IS_VOID is never defined.
• If the macro BOOST_ENABLE_ASSERT_DEBUG_HANDLER, then BOOST_ASSERT_IS_VOID is defined when NDEBUG is defined.
Copyright © 2002, 2007, 2014 by Peter Dimov. Copyright © 2011 - by Beman Dawes. Distributed under the Boost Software + by Beman Dawes. Copyright © 2015 by Ion Gaztanaga. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.