Update documentation

This commit is contained in:
Peter Dimov
2022-02-09 20:52:23 +02:00
parent 8d8e6a90de
commit abd62362ef
3 changed files with 39 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ https://www.boost.org/LICENSE_1_0.txt
* Added a `boost::source_location` parameter to `throw_exception_from_error`. * Added a `boost::source_location` parameter to `throw_exception_from_error`.
* `result<T>::value` now automatically supplies `BOOST_CURRENT_LOCATION` to * `result<T>::value` now automatically supplies `BOOST_CURRENT_LOCATION` to
`throw_exception_from_error` via a default argument. `throw_exception_from_error` via a default argument.
* Added an `errc::make_error_code` overload taking a source location.
## Changes in Boost 1.78 ## Changes in Boost 1.78

View File

@@ -185,9 +185,13 @@ namespace errc {
template<> struct is_error_condition_enum<errc::errc_t> template<> struct is_error_condition_enum<errc::errc_t>
{ static const bool value = true; }; { static const bool value = true; };
constexpr error_code make_error_code( errc::errc_t e ) noexcept;
constexpr error_condition make_error_condition( errc::errc_t e ) noexcept; constexpr error_condition make_error_condition( errc::errc_t e ) noexcept;
constexpr error_code make_error_code( errc::errc_t e ) noexcept;
error_code make_error_code( errc::errc_t e,
boost::source_location const * loc ) noexcept;
} // namespace system } // namespace system
} // namespace boost } // namespace boost
``` ```
@@ -256,6 +260,38 @@ void my_api_function( boost::system::error_code& ec )
} }
``` ```
```
constexpr error_code make_error_code( errc::errc_t e,
boost::source_location const * loc ) noexcept;
```
[none]
* {blank}
+
Returns: :: `error_code( e, generic_category(), loc )`.
Same as the above overload, but takes a source location.
* {blank}
+
```
void my_api_function( boost::system::error_code& ec )
{
void* p = std::malloc( 16 );
if( p == 0 )
{
// return ENOMEM
BOOST_STATIC_CONSTEXPR boost::source_location loc =
BOOST_CURRENT_LOCATION;
ec = make_error_code( boost::system::errc::out_of_memory, &loc );
return;
}
// use p
}
```
## <boost/system/{zwsp}error_category.hpp> ## <boost/system/{zwsp}error_category.hpp>
### error_category ### error_category

View File

@@ -37,7 +37,7 @@ BOOST_SYSTEM_CONSTEXPR inline error_code make_error_code( errc_t e ) BOOST_NOEXC
} }
// explicit conversion: // explicit conversion:
inline error_code make_error_code( errc_t e, boost::source_location const* loc ) BOOST_NOEXCEPT inline error_code make_error_code( errc_t e, boost::source_location const * loc ) BOOST_NOEXCEPT
{ {
return error_code( e, generic_category(), loc ); return error_code( e, generic_category(), loc );
} }