Reorder constructor overloads

This commit is contained in:
Peter Dimov
2021-09-16 18:04:27 +03:00
parent b507b2294e
commit 984f8f1a92
2 changed files with 20 additions and 19 deletions

View File

@ -564,12 +564,12 @@ namespace boost {
constexpr error_code() noexcept;
constexpr error_code( int val, const error_category & cat ) noexcept;
template <class ErrorCodeEnum>
constexpr error_code( ErrorCodeEnum e ) noexcept;
error_code( int val, const error_category & cat,
boost::source_location const * loc ) noexcept;
template <class ErrorCodeEnum>
constexpr error_code( ErrorCodeEnum e ) noexcept;
error_code( std::error_code const& ec ) noexcept;
// modifiers:
@ -684,16 +684,6 @@ constexpr error_code( int val, const error_category & cat ) noexcept;
+
Ensures: :: `value() == val`; `category() == cat`; `!has_location()`.
```
template <class ErrorCodeEnum>
constexpr error_code( ErrorCodeEnum e ) noexcept;
```
[none]
* {blank}
+
Ensures: :: `*this == make_error_code( e )`.
Remarks: :: This constructor is only enabled when `is_error_code_enum<ErrorCodeEnum>::value` is `true`.
```
error_code( int val, const error_category & cat,
boost::source_location const * loc ) noexcept;
@ -704,6 +694,16 @@ error_code( int val, const error_category & cat,
Requires: :: `loc` points to a valid `boost::source_location` object with static storage duration.
Ensures: :: `value() == val`; `category() == cat`; `has_location()`; `&location() == loc`.
```
template <class ErrorCodeEnum>
constexpr error_code( ErrorCodeEnum e ) noexcept;
```
[none]
* {blank}
+
Ensures: :: `*this == make_error_code( e )`.
Remarks: :: This constructor is only enabled when `is_error_code_enum<ErrorCodeEnum>::value` is `true`.
```
error_code( std::error_code const & ec ) noexcept;
```

View File

@ -98,12 +98,6 @@ public:
d1_.cat_ = &cat;
}
template<class ErrorCodeEnum> BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e,
typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0 ) BOOST_NOEXCEPT
{
*this = make_error_code( e );
}
error_code( int val, const error_category & cat, source_location const * loc ) BOOST_NOEXCEPT:
d1_(), lc_flags_( ( loc? reinterpret_cast<boost::uintptr_t>( loc ): 2 ) | +detail::failed_impl( val, cat ) )
{
@ -111,6 +105,13 @@ public:
d1_.cat_ = &cat;
}
template<class ErrorCodeEnum> BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e,
typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0 ) BOOST_NOEXCEPT:
d1_(), lc_flags_( 0 )
{
*this = make_error_code( e );
}
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
error_code( std::error_code const& ec ) BOOST_NOEXCEPT: