Skip to content

Commit

Permalink
Fix usage of make_error_code before its declaration. Resolves boostor…
Browse files Browse the repository at this point in the history
…g#323.

Moves the concrete definition of `future_errc`
to the auxiliary "detail" namespace, making ADL look in there.
Employs 'using' statements for the reuse of extant
`make_error_code` and `make_error_condition` functions, along with
ensuring backward compatibility.
  • Loading branch information
kuzkry committed Aug 14, 2023
1 parent 52b62ee commit 4f995c8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions include/boost/thread/futures/future_error_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@
namespace boost
{

//enum class future_errc
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc)
{
broken_promise = 1,
future_already_retrieved,
promise_already_satisfied,
no_state
}
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
namespace detail {
//enum class future_errc
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc)
{
broken_promise = 1,
future_already_retrieved,
promise_already_satisfied,
no_state
}
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
} // detail

using future_errc = detail::future_errc;

namespace system
{
Expand Down Expand Up @@ -56,6 +60,12 @@ namespace boost
return error_condition(underlying_cast<int>(e), boost::future_category());
}
} // system

namespace detail
{
using system::make_error_code;
using system::make_error_condition;
} // detail
} // boost

#endif // header

0 comments on commit 4f995c8

Please sign in to comment.