mirror of
https://github.com/boostorg/core.git
synced 2025-08-11 10:44:51 +02:00
Minor documentation updates.
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
[/
|
||||
Copyright 2014 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:addressof addressof]
|
||||
|
||||
[section Authors]
|
||||
@@ -18,6 +27,15 @@ address of `x`. Ordinarily, this address can be obtained by
|
||||
`boost::addressof` was originally contributed by Brad King
|
||||
based on ideas from discussion with Doug Gregor.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
namespace boost
|
||||
{
|
||||
template<class T> T* addressof( T& x );
|
||||
}
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
@@ -41,3 +59,5 @@ void f() {
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
@@ -12,9 +12,9 @@
|
||||
|
||||
[section Overview]
|
||||
|
||||
The header *<boost/checked_delete.hpp>* defines two function
|
||||
templates, *checked_delete* and *checked_array_delete*, and two
|
||||
class templates, *checked_deleter* and *checked_array_deleter*.
|
||||
The header `<boost/checked_delete.hpp>` defines two function
|
||||
templates, `checked_delete` and `checked_array_delete`, and two
|
||||
class templates, `checked_deleter` and `checked_array_deleter`.
|
||||
|
||||
The C++ Standard allows, in 5.3.5/5, pointers to incomplete
|
||||
class types to be deleted with a delete-expression. When the
|
||||
@@ -25,7 +25,7 @@ unfortunately, not all do, and programmers sometimes ignore or
|
||||
disable warnings.
|
||||
|
||||
A particularly troublesome case is when a smart pointer's
|
||||
destructor, such as *boost::scoped_ptr<T>::~scoped_ptr*, is
|
||||
destructor, such as `boost::scoped_ptr<T>::~scoped_ptr`, is
|
||||
instantiated with an incomplete type. This can often lead to
|
||||
silent, hard to track failures.
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace boost
|
||||
|
||||
[section template<class T> void checked_delete(T * p);]
|
||||
|
||||
* *Requires:* *T* must be a complete type. The expression
|
||||
* *Requires:* `T` must be a complete type. The expression
|
||||
`delete p` must be well-formed.
|
||||
* *Effects:* `delete p;`
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace boost
|
||||
|
||||
[section template<class T> void checked_array_delete(T * p);]
|
||||
|
||||
* *Requires:* *T* must be a complete type. The expression
|
||||
* *Requires:* `T` must be a complete type. The expression
|
||||
`delete [] p` must be well-formed.
|
||||
* *Effects:* `delete [] p;`
|
||||
|
||||
@@ -117,9 +117,9 @@ template<class T> struct checked_array_deleter
|
||||
|
||||
[section Acknowledgements]
|
||||
|
||||
The function templates *checked_delete* and
|
||||
*checked_array_delete* were originally part of
|
||||
*<boost/utility.hpp>*, and the documentation
|
||||
The function templates `checked_delete` and
|
||||
`checked_array_delete` were originally part of
|
||||
`<boost/utility.hpp>`, and the documentation
|
||||
acknowledged Beman Dawes, Dave Abrahams,
|
||||
Vladimir Prus, Rainer Deyke, John Maddock,
|
||||
and others as contributors.
|
||||
|
@@ -1,3 +1,12 @@
|
||||
[/
|
||||
Copyright 2014 Adam Wulkiewicz
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:ignore_unused ignore_unused]
|
||||
|
||||
[section Authors]
|
||||
@@ -15,14 +24,16 @@ can't be removed or commented out, e.g. when some blocks of the code are
|
||||
conditionally activated. C++11 variadic templates are used if they're supported,
|
||||
otherwise they're emulated with overloads.
|
||||
|
||||
Usage
|
||||
[section Usage]
|
||||
|
||||
``
|
||||
boost::ignore_unused(v1, v2, v3);
|
||||
boost::ignore_unused<T1, T2, T3>();
|
||||
``
|
||||
|
||||
Example
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
|
||||
``
|
||||
int fun( int foo, int bar )
|
||||
@@ -38,6 +49,8 @@ int fun( int foo, int bar )
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Acknowledgments]
|
||||
|
||||
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
|
||||
|
@@ -1,3 +1,14 @@
|
||||
[/
|
||||
Copyright 2010, 2011 Beman Dawes
|
||||
Copyright 2013 Ion Gaztanaga
|
||||
Copyright 2014 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:lightweight_test lightweight_test]
|
||||
|
||||
[section Authors]
|
||||
@@ -9,6 +20,31 @@
|
||||
|
||||
[section Header <boost/core/lightweight_test.hpp>]
|
||||
|
||||
The header `<boost/core/lightweight_test.hpp>` is a
|
||||
lightweight test framework. It's useful for writing
|
||||
Boost regression tests for components that are dependencies
|
||||
of Boost.Test.
|
||||
|
||||
When using `lightweight_test.hpp`, *do not forget* to
|
||||
`return boost::report_errors()` from `main`.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
#define BOOST_TEST(expression) /*unspecified*/
|
||||
#define BOOST_ERROR(message) /*unspecified*/
|
||||
#define BOOST_TEST_EQ(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_NE(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_THROWS(expr, excep) /*unspecified*/
|
||||
|
||||
namespace boost
|
||||
{
|
||||
int report_errors();
|
||||
}
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST]
|
||||
|
||||
``
|
||||
@@ -37,7 +73,7 @@ Increases error count and outputs a message containing
|
||||
BOOST_TEST_EQ(expr1, expr2)
|
||||
``
|
||||
|
||||
If `expr1` != `expr2` increases the error count and outputs a
|
||||
If `expr1 != expr2` increases the error count and outputs a
|
||||
message containing both expressions.
|
||||
|
||||
[endsect]
|
||||
@@ -48,7 +84,7 @@ message containing both expressions.
|
||||
BOOST_TEST_NE(expr1, expr2)
|
||||
``
|
||||
|
||||
If `expr1` == `expr2` increases the error count and outputs a
|
||||
If `expr1 == expr2` increases the error count and outputs a
|
||||
message containing both expressions.
|
||||
|
||||
[endsect]
|
||||
@@ -59,11 +95,11 @@ message containing both expressions.
|
||||
BOOST_TEST_THROWS(expr, excep)
|
||||
``
|
||||
|
||||
If BOOST_NO_EXCEPTIONS is NOT defined and if `expr` does not
|
||||
If `BOOST_NO_EXCEPTIONS` is *not* defined and if `expr` does not
|
||||
throw an exception of type `excep`, increases the error count
|
||||
and outputs a message containing the expression.
|
||||
|
||||
If BOOST_NO_EXCEPTIONS is defined, this macro expands to
|
||||
If `BOOST_NO_EXCEPTIONS` is defined, this macro expands to
|
||||
nothing and `expr` is not evaluated.
|
||||
|
||||
[endsect]
|
||||
@@ -76,12 +112,14 @@ int boost::report_errors()
|
||||
|
||||
Return the error count from `main`.
|
||||
|
||||
Example:
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
|
||||
``
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
void sqr( int x ); // should return x * x
|
||||
int sqr( int x ); // should return x * x
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -96,4 +134,67 @@ int main()
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Header <boost/core/lightweight_test_trait.hpp>]
|
||||
|
||||
The header `<boost/core/lightweight_test_trait.hpp>` defines
|
||||
a couple of extra macros for testing compile-time traits that
|
||||
return a boolean value.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
#define BOOST_TEST_TRAIT_TRUE((Trait)) /*unspecified*/
|
||||
#define BOOST_TEST_TRAIT_FALSE((Trait)) /*unspecified*/
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_TRAIT_TRUE]
|
||||
|
||||
``
|
||||
BOOST_TEST_TRAIT_TRUE((Trait))
|
||||
``
|
||||
|
||||
If `Trait::value != true` increases the error count and outputs a
|
||||
message containing `Trait`. Note the double set of parentheses; these
|
||||
enable `Trait` to contain a comma, which is common for templates.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_TRAIT_FALSE]
|
||||
|
||||
``
|
||||
BOOST_TEST_TRAIT_FALSE((Trait))
|
||||
``
|
||||
|
||||
If `Trait::value != false` increases the error count and outputs a
|
||||
message containing `Trait`. Note the double set of parentheses.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
|
||||
``
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <boost/core/is_same.hpp>
|
||||
|
||||
template<class T, class U> struct X
|
||||
{
|
||||
typedef T type;
|
||||
}
|
||||
|
||||
using boost::core::is_same;
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_TRAIT_TRUE(( is_same<X<int, long>::type, int> ));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
@@ -1,3 +1,13 @@
|
||||
[/
|
||||
Copyright 2004 Pavel Vozenilek
|
||||
Copyright 2014 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:no_exceptions_support no_exceptions_support]
|
||||
|
||||
[section Authors]
|
||||
@@ -8,7 +18,22 @@
|
||||
|
||||
[section Header <boost/core/no_exceptions_support.hpp>]
|
||||
|
||||
Example of use:
|
||||
The header `<boost/core/no_exceptions_support.hpp>` defines
|
||||
macros for use in code that needs to be portable to environments
|
||||
that do not have support for C++ exceptions.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
#define BOOST_TRY /*unspecified*/
|
||||
#define BOOST_CATCH(x) /*unspecified*/
|
||||
#define BOOST_CATCH_END /*unspecified*/
|
||||
#define BOOST_RETHROW /*unspecified*/
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Example Use]
|
||||
|
||||
``
|
||||
void foo() {
|
||||
@@ -58,3 +83,5 @@ void foo() {
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
@@ -1,3 +1,13 @@
|
||||
[/
|
||||
Copyright 1999-2003 Beman Dawes
|
||||
Copyright 2014 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:noncopyable noncopyable]
|
||||
|
||||
[section Authors]
|
||||
@@ -18,6 +28,29 @@ from it inherits these properties.
|
||||
`boost::noncopyable` was originally contributed by Dave
|
||||
Abrahams.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
namespace boost
|
||||
{
|
||||
class noncopyable;
|
||||
}
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
|
||||
``
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
|
||||
class X: private boost::noncopyable
|
||||
{
|
||||
};
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
Reference in New Issue
Block a user