1
0
forked from boostorg/core

Merge branch 'develop' of https://github.com/boostorg/core into develop

This commit is contained in:
Peter Dimov
2014-06-06 02:35:21 +03:00
13 changed files with 236 additions and 111 deletions

View File

@@ -1,4 +1,14 @@
[section:addressof Header <boost/core/addressof.hpp>]
[section:addressof addressof]
[section Authors]
* Brad King
* Douglas Gregor
* Peter Dimov
[endsect]
[section Header <boost/core/addressof.hpp>]
The header `<boost/core/addressof.hpp>` defines the function
template `boost::addressof`. `boost::addressof(x)` returns the
@@ -9,3 +19,25 @@ address of `x`. Ordinarily, this address can be obtained by
based on ideas from discussion with Doug Gregor.
[endsect]
[section Example]
``
#include <boost/core/addressof.hpp>
struct useless_type { };
class nonaddressable {
useless_type operator&() const;
};
void f() {
nonaddressable x;
nonaddressable* xp = boost::addressof(x);
// nonaddressable* xpe = &x; /* error */
}
``
[endsect]
[endsect]

View File

@@ -1,4 +1,16 @@
[section:checked_delete Header <boost/core/checked_delete.hpp>]
[section:checked_delete checked_delete]
[section Authors]
* Beman Dawes
* Dave Abrahams
* Vladimir Prus
* Rainer Deyke
* John Maddock
[endsect]
[section Overview]
The header *<boost/checked_delete.hpp>* defines two function
templates, *checked_delete* and *checked_array_delete*, and two
@@ -21,6 +33,8 @@ The supplied function and class templates can be used to
prevent these problems, as they require a complete type, and
cause a compilation error otherwise.
[endsect]
[section Synopsis]
``

View File

@@ -30,63 +30,6 @@ criteria for inclusion is that the utility component be:
* not dependent on any other Boost modules except Core
itself, Config, Assert, Static Assert, or Predef.
Currently, the Core library contains:
[table
[[Component][Utilities]]
[
[[link core.addressof addressof]]
[`boost::addressof`]
]
[
[[link core.checked_delete checked_delete]]
[`boost::checked_delete`]
]
[
[[link core.enable_if enable_if]]
[`boost::enable_if`]
]
[
[[link core.explicit_operator_bool explicit_operator_bool]]
[`BOOST_EXPLICIT_OPERATOR_BOOL,
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT,
BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL`]
]
[
[[link core.ignore_unused ignore_unused]]
[`boost::ignore_unused`]
]
[
[[link core.lightweight_test lightweight_test]]
[`BOOST_TEST, BOOST_ERROR, BOOST_TEST_EQ, BOOST_TEST_NE,
BOOST_TEST_THROWS, boost::report_errors`]
]
[
[[link core.no_exceptions_support no_exceptions_support]]
[`BOOST_TRY, BOOST_CATCH, BOOST_CATCH_END, BOOST_RETHROW`]
]
[
[[link core.noncopyable noncopyable]]
[`boost::noncopyable`]
]
[
[[link core.null_deleter null_deleter]]
[`boost::null_deleter`]
]
[
[[link core.ref ref]]
[`boost::ref`]
]
[
[[link core.scoped_enum scoped_enum]]
[Components for portable declaration of scoped enums.]
]
[
[[link core.swap swap]]
[`boost::swap`]
]
]
[endsect]
[include:core addressof.qbk]

View File

@@ -1,4 +1,12 @@
[section:enable_if Header <boost/core/enable_if.hpp>]
[section:enable_if enable_if]
[section Authors]
* Jaakko J\u00E4rvi
* Jeremiah Willcock
* Andrew Lumsdaine
[endsect]
[section Introduction]
@@ -13,7 +21,7 @@ be applied to enable class template specializations.
Applications of `enable_if` are discussed in length in
[link REF1 \[1\]] and [link REF2 \[2\]].
[section Synopsis]
[section Header <boost/core/enable_if.hpp>]
``
namespace boost {

View File

@@ -1,4 +1,4 @@
[section:explicit_operator_bool Header <boost/core/explicit_operator_bool.hpp>]
[section:explicit_operator_bool explicit_operator_bool]
[/
/ Copyright (c) 2013 Andrey Semashev
@@ -7,11 +7,27 @@
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[/==============]
[section Authors]
[/==============]
* Andrey Semashev
[endsect]
[/===============]
[section Overview]
[/===============]
`BOOST_EXPLICIT_OPERATOR_BOOL()`, `BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()` and `BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()` are compatibility helper macros that expand to an explicit conversion operator to `bool`. For compilers not supporting explicit conversion operators introduced in C++11 the macros expand to a conversion operator that implements the [@http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool safe bool idiom]. In case if the compiler is not able to handle safe bool idiom well the macros expand to a regular conversion operator to `bool`.
Header `<boost/core/explicit_operator_bool.hpp>` provides
`BOOST_EXPLICIT_OPERATOR_BOOL()`, `BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()`
and `BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()` compatibility helper macros
that expand to an explicit conversion operator to `bool`. For compilers not
supporting explicit conversion operators introduced in C++11 the macros expand
to a conversion operator that implements the
[@http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool safe bool idiom].
In case if the compiler is not able to handle safe bool idiom well the macros
expand to a regular conversion operator to `bool`.
[endsect]
@@ -19,33 +35,47 @@
[section Examples]
[/===============]
Both macros are intended to be placed within a user's class definition. The generated conversion operators will be implemented in terms of `operator!()` that should be defined by user in this class. In case of `BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()` the generated conversion operator will be declared `constexpr` which requires the corresponding `operator!()` to also be `constexpr`.
Both macros are intended to be placed within a user's class definition. The
generated conversion operators will be implemented in terms of `operator!()`
that should be defined by user in this class. In case of
`BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()` the generated conversion operator
will be declared `constexpr` which requires the corresponding `operator!()`
to also be `constexpr`.
template< typename T >
class my_ptr
{
``
template< typename T >
class my_ptr
{
T* m_p;
public:
public:
BOOST_EXPLICIT_OPERATOR_BOOL()
bool operator!() const
{
return !m_p;
}
};
};
``
Now `my_ptr` can be used in conditional expressions, similarly to a regular pointer:
my_ptr< int > p;
if (p)
``
my_ptr< int > p;
if (p)
std::cout << "true" << std::endl;
``
[endsect]
[/===============]
[/==============]
[section History]
[/===============]
[/==============]
[heading boost 1.56]
* Added new macros `BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT` and `BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL` to define `noexcept` and `constexpr` operators.
* The header moved to Boost.Core.
[heading boost 1.55]

View File

@@ -1,4 +1,12 @@
[section:ignore_unused Header <boost/core/ignore_unused.hpp>]
[section:ignore_unused ignore_unused]
[section Authors]
* Adam Wulkiewicz
[endsect]
[section Header <boost/core/ignore_unused.hpp>]
The header `<boost/core/ignore_unused.hpp>` defines the function template
`boost::ignore_unused()`. It may be used to suppress the "unused variable" or
@@ -7,23 +15,33 @@ 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.
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
Usage
boost::ignore_unused(v1, v2, v3);
boost::ignore_unused<T1, T2, T3>();
``
boost::ignore_unused(v1, v2, v3);
boost::ignore_unused<T1, T2, T3>();
``
Example
int fun( int foo, int bar )
{
``
int fun( int foo, int bar )
{
boost::ignore_unused(bar);
#ifdef ENABLE_DEBUG_OUTPUT
#ifdef ENABLE_DEBUG_OUTPUT
if ( foo < bar )
std::cerr << "warning! foo < bar";
#endif
#endif
return foo + 2;
}
}
``
[endsect]
[section Acknowledgments]
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
[endsect]
[endsect]

View File

@@ -1,4 +1,13 @@
[section:lightweight_test Header <boost/core/lightweight_test.hpp>]
[section:lightweight_test lightweight_test]
[section Authors]
* Peter Dimov
* Beman Dawes
[endsect]
[section Header <boost/core/lightweight_test.hpp>]
[section BOOST_TEST]
@@ -86,3 +95,5 @@ int main()
[endsect]
[endsect]
[endsect]

View File

@@ -1,4 +1,12 @@
[section:no_exceptions_support Header <boost/core/no_exceptions_support.hpp>]
[section:no_exceptions_support no_exceptions_support]
[section Authors]
* Pavel Vozenilek
[endsect]
[section Header <boost/core/no_exceptions_support.hpp>]
Example of use:
@@ -48,3 +56,5 @@ void foo() {
``
[endsect]
[endsect]

View File

@@ -1,4 +1,12 @@
[section:noncopyable Header <boost/core/noncopyable.hpp>]
[section:noncopyable noncopyable]
[section Authors]
* Dave Abrahams
[endsect]
[section Header <boost/core/noncopyable.hpp>]
The header `<boost/noncopyable.hpp>` defines the class
`boost::noncopyable`. It is intended to be used as a private
@@ -11,3 +19,5 @@ from it inherits these properties.
Abrahams.
[endsect]
[endsect]

View File

@@ -5,7 +5,15 @@
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:null_deleter Header <boost/core/null_deleter.hpp>]
[section:null_deleter null_deleter]
[section Authors]
* Andrey Semashev
[endsect]
[section Header <boost/core/null_deleter.hpp>]
The header `<boost/core/null_deleter.hpp>` defines the `boost::null_deleter` function object,
which can be used as a deleter with smart pointers such as `unique_ptr` or `shared_ptr`. The
@@ -20,3 +28,5 @@ Example
}
[endsect]
[endsect]

View File

@@ -1,4 +1,15 @@
[section:ref Header <boost/core/ref.hpp>]
[section:ref ref]
[section Authors]
* Jaakko J\u00E4rvi
* Peter Dimov
* Douglas Gregor
* Dave Abrahams
* Frank Mori Hess
* Ronald Garcia
[endsect]
[section Introduction]

View File

@@ -1,4 +1,13 @@
[section:scoped_enum Headers <boost/core/scoped_enum.hpp>, <boost/core/underlying_type.hpp>]
[section:scoped_enum scoped_enum]
[section Authors]
* Beman Dawes
* Vicente J. Botet Escriba
[endsect]
[section Overview]
The `boost/core/scoped_enum.hpp` header contains a number of macros that can be used to generate
C++11 scoped enums (7.2 \[dcl.enum\]) if the feature is supported by the compiler, otherwise emulate
@@ -96,7 +105,9 @@ Sample usage:
sample = algae::green;
foo( algae::cyan );
[heading Deprecated syntax]
[endsect]
[section Deprecated syntax]
In early versions of the header there were two ways to declare scoped enums, with different pros and cons to each.
The other way used a different set of macros:
@@ -120,7 +131,9 @@ and `BOOST_SCOPED_ENUM` to `BOOST_SCOPED_ENUM_NATIVE`. Note also the semicolon b
In the current version these macros produce equivalent result to the ones described above and are considered deprecated.
[heading Acquiring the underlying type of the enum]
[endsect]
[section Acquiring the underlying type of the enum]
The header `boost/core/underlying_type.hpp` defines the metafunction `boost::underlying_type` which can be used to
obtain the underlying type of the scoped enum. This metafunction has support for emulated scoped enums declared with
@@ -131,13 +144,15 @@ Unfortunately, there are configurations which implement scoped enums but not `st
`boost::underlying_type` has to be specialized by user. The macro `BOOST_NO_UNDERLYING_TYPE` is defined to indicate
such cases.
[heading Acknowledgements]
[endsect]
Thanks to Andrey Semashev for pointing out that emulation through a namespace
could not be used within classes.
[section Acknowledgments]
Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vicente
Botet, and Daniel James.
This scoped enum emulation was developed by Beman Dawes, Vicente J. Botet Escriba and Anthony Williams.
Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida,
Matt Calabrese, Daniel James and Andrey Semashev.
[endsect]
[endsect]

View File

@@ -1,7 +1,20 @@
[section:swap Header <boost/core/swap.hpp>]
[section:swap swap]
[section Authors]
* Niels Dekker
* Joseph Gauterin
* Steven Watanabe
* Eric Niebler
[endsect]
[section Header <boost/core/swap.hpp>]
`template<class T> void swap(T& left, T& right);`
[endsect]
[section Introduction]
The template function `boost::swap` allows the values of two