From 984f8f1a92a97be204fa428d3db02fa8046f28e6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 16 Sep 2021 18:04:27 +0300 Subject: [PATCH] Reorder constructor overloads --- doc/system/reference.adoc | 26 +++++++++++----------- include/boost/system/detail/error_code.hpp | 13 ++++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/doc/system/reference.adoc b/doc/system/reference.adoc index 52fe2fe..ba6fdc4 100644 --- a/doc/system/reference.adoc +++ b/doc/system/reference.adoc @@ -564,12 +564,12 @@ namespace boost { constexpr error_code() noexcept; constexpr error_code( int val, const error_category & cat ) noexcept; - template - constexpr error_code( ErrorCodeEnum e ) noexcept; - error_code( int val, const error_category & cat, boost::source_location const * loc ) noexcept; + template + 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 - 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::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 + 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::value` is `true`. + ``` error_code( std::error_code const & ec ) noexcept; ``` diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index 5756c8d..68c73c5 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -98,12 +98,6 @@ public: d1_.cat_ = &cat; } - template BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e, - typename detail::enable_if::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( loc ): 2 ) | +detail::failed_impl( val, cat ) ) { @@ -111,6 +105,13 @@ public: d1_.cat_ = &cat; } + template BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e, + typename detail::enable_if::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: