diff --git a/assert.html b/assert.html deleted file mode 100644 index e1c5b4f..0000000 --- a/assert.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - Boost: assert.hpp documentation - - - - - - - - - - - -
boost.png (6897 bytes) - -

assert.hpp

-
 
-

- BOOST_ASSERT
- BOOST_ASSERT_MSG
- BOOST_VERIFY
- BOOST_VERIFY_MSG
- BOOST_ASSERT_IS_VOID
-

- -

BOOST_ASSERT

-

- The header <boost/assert.hpp> defines the macro BOOST_ASSERT, - which is similar to the standard assert macro defined in <cassert>. - The macro is intended to be used in both Boost libraries and user - code. -

-

• By default, BOOST_ASSERT(expr) expands to assert(expr).

-

• If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> - is included, BOOST_ASSERT(expr) expands to ((void)0), regardless of whether - the macro NDEBUG is defined. This allows users to selectively disable BOOST_ASSERT without - affecting the definition of the standard assert.

-

• If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_ASSERT(expr) expands to

-
-
(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
-
-

That is, it evaluates expr and if it's false, calls ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__). - This is true regardless of whether NDEBUG is defined.

-

boost::assertion_failed is declared in <boost/assert.hpp> as

-
-
namespace boost
-{
-  void assertion_failed(char const * expr, char const * function, char const * file, long line);
-}
-
-
-

but it is never defined. The user is expected to supply an appropriate - definition.

-

• If the macro BOOST_ENABLE_ASSERT_DEBUG_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_ASSERT(expr) expands to ((void)0) when NDEBUG is - defined. Otherwise the behavior is as if BOOST_ENABLE_ASSERT_HANDLER has been defined.

-

As is the case with <cassert>, <boost/assert.hpp> - can be included multiple times in a single translation unit. BOOST_ASSERT - will be redefined each time as specified above.

- -

BOOST_ASSERT_MSG

-

- The macro BOOST_ASSERT_MSG is similar to BOOST_ASSERT, but it takes an additional argument, - a character literal, supplying an error message.

-

• By default, BOOST_ASSERT_MSG(expr,msg) expands to assert((expr)&&(msg)).

-

• If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> - is included, BOOST_ASSERT_MSG(expr,msg) expands to ((void)0), regardless of whether - the macro NDEBUG is defined.

-

• If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_ASSERT_MSG(expr,msg) expands to

-
-
(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
-
-

This is true regardless of whether NDEBUG is defined.

-

boost::assertion_failed_msg is declared in <boost/assert.hpp> as

-
-
namespace boost
-{
-  void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line);
-}
-
-
-

but it is never defined. The user is expected to supply an appropriate - definition.

-

• If the macro BOOST_ENABLE_ASSERT_DEBUG_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_ASSERT_MSG(expr) expands to ((void)0) when NDEBUG is - defined. Otherwise the behavior is as if BOOST_ENABLE_ASSERT_HANDLER has been defined.

-

As is the case with <cassert>, <boost/assert.hpp> - can be included multiple times in a single translation unit. BOOST_ASSERT_MSG - will be redefined each time as specified above.

- -

BOOST_VERIFY

-

The macro BOOST_VERIFY has the same behavior as BOOST_ASSERT, except that - the expression that is passed to BOOST_VERIFY is always - evaluated. This is useful when the asserted expression has desirable side - effects; it can also help suppress warnings about unused variables when the - only use of the variable is inside an assertion.

-

• If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> - is included, BOOST_VERIFY(expr) expands to ((void)(expr)).

-

• If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_VERIFY(expr) expands to BOOST_ASSERT(expr).

-

• Otherwise, BOOST_VERIFY(expr) expands to ((void)(expr)) when NDEBUG is - defined, to BOOST_ASSERT(expr) when it's not.

-

BOOST_VERIFY_MSG

-

The macro BOOST_VERIFY_MSG is similar to BOOST_VERIFY, with an additional parameter, an error message.

-

• If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> - is included, BOOST_VERIFY_MSG(expr,msg) expands to ((void)(expr)).

-

• If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> - is included, BOOST_VERIFY_MSG(expr,msg) expands to BOOST_ASSERT_MSG(expr,msg).

-

• Otherwise, BOOST_VERIFY_MSG(expr,msg) expands to ((void)(expr)) when NDEBUG is - defined, to BOOST_ASSERT_MSG(expr,msg) when it's not.

-
-

-

BOOST_ASSERT_IS_VOID

-

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_VOID
-     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.  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.

- - diff --git a/current_function.html b/current_function.html deleted file mode 100644 index f7f6515..0000000 --- a/current_function.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - Boost: current_function.hpp documentation - - - - - - - - - - - -
boost.png (6897 bytes) - -

current_function.hpp

-
 
-

- The header <boost/current_function.hpp> defines a single - macro, BOOST_CURRENT_FUNCTION, similar to the - C99 predefined identifier __func__. -

-

BOOST_CURRENT_FUNCTION expands to a string literal containing - the (fully qualified, if possible) name of the enclosing function. If there is - no enclosing function, the behavior is undefined.

-

Some compilers do not provide a way to obtain the name of the current enclosing - function. On such compilers, BOOST_CURRENT_FUNCTION expands to - "(unknown)".

-
-

- Copyright © 2002 by Peter Dimov. 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.

- - diff --git a/doc/Jamfile b/doc/Jamfile new file mode 100644 index 0000000..24f9c5b --- /dev/null +++ b/doc/Jamfile @@ -0,0 +1,29 @@ +# Copyright 2017 Peter Dimov +# +# 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) + +project doc/assert ; + +import asciidoctor ; +# import boostbook ; + +html assert.html : index.adoc ; + +# docbook assert.docbook : index.adoc ; +# boostbook assert.html : assert.docbook : onehtml ; + +install html_ : assert.html : html ; + +pdf assert.pdf : index.adoc ; +explicit assert.pdf ; + +install pdf_ : assert.pdf : pdf ; +explicit pdf_ ; + +############################################################################### +alias boostdoc ; +explicit boostdoc ; +alias boostrelease ; +explicit boostrelease ; diff --git a/doc/asciidoctor.jam b/doc/asciidoctor.jam new file mode 100644 index 0000000..488670d --- /dev/null +++ b/doc/asciidoctor.jam @@ -0,0 +1,50 @@ +# Copyright 2017 Peter Dimov +# +# 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) + +import type ; +import scanner ; +import generators ; +import boostbook ; + +# File type + +type.register ASCIIDOC : asciidoc adoc ; + +# Define dependency scanner + +class asciidoc-scanner : common-scanner +{ + rule pattern ( ) + { + return "include::([^[]+)\\[" ; + } +} + +scanner.register asciidoc-scanner : include ; +type.set-scanner ASCIIDOC : asciidoc-scanner ; + +# Define generators + +generators.register-standard asciidoctor.asciidoc-to-html : ASCIIDOC : HTML ; +generators.register-standard asciidoctor.asciidoc-to-pdf : ASCIIDOC : PDF ; +# generators.register-standard asciidoctor.asciidoc-to-docbook : ASCIIDOC : DOCBOOK ; + +# Define actions + +actions asciidoc-to-html +{ + asciidoctor -b html -o $(1) $(2) +} + +actions asciidoc-to-pdf +{ + asciidoctor -r asciidoctor-pdf -b pdf -o $(1) $(2) +} + +actions asciidoc-to-docbook +{ + asciidoctor -b docbook -o $(1) $(2) +} diff --git a/doc/assert.adoc b/doc/assert.adoc new file mode 100644 index 0000000..4aae737 --- /dev/null +++ b/doc/assert.adoc @@ -0,0 +1,165 @@ +//// +Copyright 2002, 2007, 2014, 2017 Peter Dimov +Copyright 2011 Beman Dawes +Copyright 2015 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 +//// + +# Assertion Macros, +:toc: +:toc-title: +:idprefix: + +## BOOST_ASSERT + +The header `` defines the macro `BOOST_ASSERT`, +which is similar to the standard `assert` macro defined in ``. +The macro is intended to be used in both Boost libraries and user +code. + +* By default, `BOOST_ASSERT(expr)` expands to `assert(expr)`. + +* If the macro `BOOST_DISABLE_ASSERTS` is defined when `` + is included, `BOOST_ASSERT(expr)` expands to `((void)0)`, regardless of whether + the macro `NDEBUG` is defined. This allows users to selectively disable `BOOST_ASSERT` without + affecting the definition of the standard `assert`. + +* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `` +is included, `BOOST_ASSERT(expr)` expands to ++ +``` +(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, + BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) +``` ++ +That is, it evaluates `expr` and if it's false, calls +`::boost::assertion_failed(#expr, <>, \\__FILE__, \\__LINE__)`. +This is true regardless of whether `NDEBUG` is defined. ++ +`boost::assertion_failed` is declared in `` as ++ +``` +namespace boost +{ + void assertion_failed(char const * expr, char const * function, + char const * file, long line); +} +``` ++ +but it is never defined. The user is expected to supply an appropriate definition. + +* If the macro `BOOST_ENABLE_ASSERT_DEBUG_HANDLER` is defined when `` +is included, `BOOST_ASSERT(expr)` expands to `((void)0)` when `NDEBUG` is +defined. Otherwise the behavior is as if `BOOST_ENABLE_ASSERT_HANDLER` has been defined. + +As is the case with ``, `` +can be included multiple times in a single translation unit. `BOOST_ASSERT` +will be redefined each time as specified above. + +## BOOST_ASSERT_MSG + +The macro `BOOST_ASSERT_MSG` is similar to `BOOST_ASSERT`, but it takes an additional argument, +a character literal, supplying an error message. + +* By default, `BOOST_ASSERT_MSG(expr,msg)` expands to `assert\((expr)&&(msg))`. + +* If the macro `BOOST_DISABLE_ASSERTS` is defined when `` +is included, `BOOST_ASSERT_MSG(expr,msg)` expands to `((void)0)`, regardless of whether +the macro `NDEBUG` is defined. + +* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `` +is included, `BOOST_ASSERT_MSG(expr,msg)` expands to ++ +``` +(BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, + msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) +``` ++ +This is true regardless of whether `NDEBUG` is defined. ++ +`boost::assertion_failed_msg` is declared in `` as ++ +``` +namespace boost +{ + void assertion_failed_msg(char const * expr, char const * msg, + char const * function, char const * file, long line); +} +``` ++ +but it is never defined. The user is expected to supply an appropriate definition. + +* If the macro `BOOST_ENABLE_ASSERT_DEBUG_HANDLER` is defined when `` +is included, `BOOST_ASSERT_MSG(expr)` expands to `((void)0)` when `NDEBUG` is +defined. Otherwise the behavior is as if `BOOST_ENABLE_ASSERT_HANDLER` has been defined. + +As is the case with ``, `` +can be included multiple times in a single translation unit. `BOOST_ASSERT_MSG` +will be redefined each time as specified above. + +## BOOST_VERIFY + +The macro `BOOST_VERIFY` has the same behavior as `BOOST_ASSERT`, except that +the expression that is passed to `BOOST_VERIFY` is always +evaluated. This is useful when the asserted expression has desirable side +effects; it can also help suppress warnings about unused variables when the +only use of the variable is inside an assertion. + +* If the macro `BOOST_DISABLE_ASSERTS` is defined when `` + is included, `BOOST_VERIFY(expr)` expands to `\((void)(expr))`. + +* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `` + is included, `BOOST_VERIFY(expr)` expands to `BOOST_ASSERT(expr)`. + +* Otherwise, `BOOST_VERIFY(expr)` expands to `\((void)(expr))` when `NDEBUG` is + defined, to `BOOST_ASSERT(expr)` when it's not. + +## BOOST_VERIFY_MSG + +The macro `BOOST_VERIFY_MSG` is similar to `BOOST_VERIFY`, with an additional parameter, an error message. + +* If the macro `BOOST_DISABLE_ASSERTS` is defined when `` + is included, `BOOST_VERIFY_MSG(expr,msg)` expands to `\((void)(expr))`. + +* If the macro `BOOST_ENABLE_ASSERT_HANDLER` is defined when `` + is included, `BOOST_VERIFY_MSG(expr,msg)` expands to `BOOST_ASSERT_MSG(expr,msg)`. + +* Otherwise, `BOOST_VERIFY_MSG(expr,msg)` expands to `\((void)(expr))` when `NDEBUG` is + defined, to `BOOST_ASSERT_MSG(expr,msg)` when it's not. + +## BOOST_ASSERT_IS_VOID + +The macro `BOOST_ASSERT_IS_VOID` is defined when `BOOST_ASSERT` and `BOOST_ASSERT_MSG` are expanded to `((void)0)`. +Its purpose is 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_VOID + + 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` is defined, then `BOOST_ASSERT_IS_VOID` is defined when `NDEBUG` is defined. diff --git a/doc/current_function.adoc b/doc/current_function.adoc new file mode 100644 index 0000000..9235c1a --- /dev/null +++ b/doc/current_function.adoc @@ -0,0 +1,30 @@ +//// +Copyright 2002, 2017 Peter Dimov + +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 +//// + +# Current Function Macro, +:toc: +:toc-title: +:idprefix: + +## BOOST_CURRENT_FUNCTION + +The header `` defines a single macro, `BOOST_CURRENT_FUNCTION`, +similar to the C99 predefined identifier `\\__func__`. + +`BOOST_CURRENT_FUNCTION` expands to a string literal containing +the (fully qualified, if possible) name of the enclosing function. If there is +no enclosing function, the behavior is unspecified. + +Some compilers do not provide a way to obtain the name of the current enclosing +function. On such compilers, or when the macro `BOOST_DISABLE_CURRENT_FUNCTION` +is defined, `BOOST_CURRENT_FUNCTION` expands to `"(unknown)"`. + +`BOOST_DISABLE_CURRENT_FUNCTION` addresses a use case in which the programmer +wishes to eliminate the string literals produced by `BOOST_CURRENT_FUNCTION` from +the final executable for security reasons. diff --git a/doc/html/assert.html b/doc/html/assert.html new file mode 100644 index 0000000..2b20523 --- /dev/null +++ b/doc/html/assert.html @@ -0,0 +1,735 @@ + + + + + + + + +Boost.Assert + + + + + +
+
+
+
+

The Boost.Assert library provides several configurable diagnostic macros +similar in behavior and purpose to the standard macro assert from <cassert>.

+
+
+
+
+

Assertion Macros, <boost/assert.hpp>

+
+
+

BOOST_ASSERT

+
+

The header <boost/assert.hpp> defines the macro BOOST_ASSERT, +which is similar to the standard assert macro defined in <cassert>. +The macro is intended to be used in both Boost libraries and user +code.

+
+
+
    +
  • +

    By default, BOOST_ASSERT(expr) expands to assert(expr).

    +
  • +
  • +

    If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> +is included, BOOST_ASSERT(expr) expands to ((void)0), regardless of whether +the macro NDEBUG is defined. This allows users to selectively disable BOOST_ASSERT without +affecting the definition of the standard assert.

    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_ASSERT(expr) expands to

    +
    +
    +
    (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr,
    +    BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
    +
    +
    +
    +

    That is, it evaluates expr and if it’s false, calls +::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__). +This is true regardless of whether NDEBUG is defined.

    +
    +
    +

    boost::assertion_failed is declared in <boost/assert.hpp> as

    +
    +
    +
    +
    namespace boost
    +{
    +    void assertion_failed(char const * expr, char const * function,
    +        char const * file, long line);
    +}
    +
    +
    +
    +

    but it is never defined. The user is expected to supply an appropriate definition.

    +
    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_DEBUG_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_ASSERT(expr) expands to ((void)0) when NDEBUG is +defined. Otherwise the behavior is as if BOOST_ENABLE_ASSERT_HANDLER has been defined.

    +
  • +
+
+
+

As is the case with <cassert>, <boost/assert.hpp> +can be included multiple times in a single translation unit. BOOST_ASSERT +will be redefined each time as specified above.

+
+
+
+

BOOST_ASSERT_MSG

+
+

The macro BOOST_ASSERT_MSG is similar to BOOST_ASSERT, but it takes an additional argument, +a character literal, supplying an error message.

+
+
+
    +
  • +

    By default, BOOST_ASSERT_MSG(expr,msg) expands to assert((expr)&&(msg)).

    +
  • +
  • +

    If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> +is included, BOOST_ASSERT_MSG(expr,msg) expands to ((void)0), regardless of whether +the macro NDEBUG is defined.

    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_ASSERT_MSG(expr,msg) expands to

    +
    +
    +
    (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr,
    +    msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
    +
    +
    +
    +

    This is true regardless of whether NDEBUG is defined.

    +
    +
    +

    boost::assertion_failed_msg is declared in <boost/assert.hpp> as

    +
    +
    +
    +
    namespace boost
    +{
    +    void assertion_failed_msg(char const * expr, char const * msg,
    +        char const * function, char const * file, long line);
    +}
    +
    +
    +
    +

    but it is never defined. The user is expected to supply an appropriate definition.

    +
    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_DEBUG_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_ASSERT_MSG(expr) expands to ((void)0) when NDEBUG is +defined. Otherwise the behavior is as if BOOST_ENABLE_ASSERT_HANDLER has been defined.

    +
  • +
+
+
+

As is the case with <cassert>, <boost/assert.hpp> +can be included multiple times in a single translation unit. BOOST_ASSERT_MSG +will be redefined each time as specified above.

+
+
+
+

BOOST_VERIFY

+
+

The macro BOOST_VERIFY has the same behavior as BOOST_ASSERT, except that +the expression that is passed to BOOST_VERIFY is always +evaluated. This is useful when the asserted expression has desirable side +effects; it can also help suppress warnings about unused variables when the +only use of the variable is inside an assertion.

+
+
+
    +
  • +

    If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> +is included, BOOST_VERIFY(expr) expands to ((void)(expr)).

    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_VERIFY(expr) expands to BOOST_ASSERT(expr).

    +
  • +
  • +

    Otherwise, BOOST_VERIFY(expr) expands to ((void)(expr)) when NDEBUG is +defined, to BOOST_ASSERT(expr) when it’s not.

    +
  • +
+
+
+
+

BOOST_VERIFY_MSG

+
+

The macro BOOST_VERIFY_MSG is similar to BOOST_VERIFY, with an additional parameter, an error message.

+
+
+
    +
  • +

    If the macro BOOST_DISABLE_ASSERTS is defined when <boost/assert.hpp> +is included, BOOST_VERIFY_MSG(expr,msg) expands to ((void)(expr)).

    +
  • +
  • +

    If the macro BOOST_ENABLE_ASSERT_HANDLER is defined when <boost/assert.hpp> +is included, BOOST_VERIFY_MSG(expr,msg) expands to BOOST_ASSERT_MSG(expr,msg).

    +
  • +
  • +

    Otherwise, BOOST_VERIFY_MSG(expr,msg) expands to ((void)(expr)) when NDEBUG is +defined, to BOOST_ASSERT_MSG(expr,msg) when it’s not.

    +
  • +
+
+
+
+

BOOST_ASSERT_IS_VOID

+
+

The macro BOOST_ASSERT_IS_VOID is defined when BOOST_ASSERT and BOOST_ASSERT_MSG are expanded to ((void)0). +Its purpose is 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_VOID
+
+    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 is defined, then BOOST_ASSERT_IS_VOID is defined when NDEBUG is defined.

    +
  • +
+
+
+
+
+
+

Current Function Macro, <boost/current_function.hpp>

+
+
+

BOOST_CURRENT_FUNCTION

+
+

The header <boost/current_function.hpp> defines a single macro, BOOST_CURRENT_FUNCTION, +similar to the C99 predefined identifier __func__.

+
+
+

BOOST_CURRENT_FUNCTION expands to a string literal containing +the (fully qualified, if possible) name of the enclosing function. If there is +no enclosing function, the behavior is unspecified.

+
+
+

Some compilers do not provide a way to obtain the name of the current enclosing +function. On such compilers, or when the macro BOOST_DISABLE_CURRENT_FUNCTION +is defined, BOOST_CURRENT_FUNCTION expands to "(unknown)".

+
+
+

BOOST_DISABLE_CURRENT_FUNCTION addresses a use case in which the programmer +wishes to eliminate the string literals produced by BOOST_CURRENT_FUNCTION from +the final executable for security reasons.

+
+
+
+
+
+ +
+
+

This documentation is

+
+
+
    +
  • +

    Copyright 2002, 2007, 2014, 2017 Peter Dimov

    +
  • +
  • +

    Copyright 2011 Beman Dawes

    +
  • +
  • +

    Copyright 2015 Ion Gaztanaga

    +
  • +
  • +

    Distributed under the Boost Software License, Version 1.0.

    +
  • +
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/index.adoc b/doc/index.adoc new file mode 100644 index 0000000..fccb1e2 --- /dev/null +++ b/doc/index.adoc @@ -0,0 +1,34 @@ +//// +Copyright 2017 Peter Dimov + +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 +//// + +# Boost.Assert +Peter Dimov +:toc: left +:idprefix: + +The Boost.Assert library provides several configurable diagnostic macros +similar in behavior and purpose to the standard macro `assert` from ``. + +:leveloffset: +1 + +include::assert.adoc[] + +include::current_function.adoc[] + +:leveloffset: -1 + +[appendix] +## Copyright and License + +This documentation is + +* Copyright 2002, 2007, 2014, 2017 Peter Dimov +* Copyright 2011 Beman Dawes +* Copyright 2015 Ion Gaztanaga +* Distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0]. diff --git a/index.html b/index.html index d59ad22..a3c843e 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,10 @@ - + Automatic redirection failed, please go to -assert.html. +doc/html/assert.html.