Skip to content

Commit

Permalink
fix: Adapt status-code API changes
Browse files Browse the repository at this point in the history
`system_error2::erased` has been made an implementation detail and been
replaced in the API by additional type aliases.
  • Loading branch information
BurningEnlightenment committed Nov 22, 2023
1 parent 3933a50 commit f84a709
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/dplx/cncr/data_defined_status_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ class data_defined_status_domain_type : public system_error::status_code_domain
{
template <class DomainType>
friend class system_error::status_code;
template <class StatusCode>
friend class system_error::detail::indirecting_domain;

public:
using value_type = Enum;
Expand Down
10 changes: 10 additions & 0 deletions src/dplx/cncr/data_defined_status_domain.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <status-code/nested_status_code.hpp>
#include <status-code/quick_status_code_from_enum.hpp>
#include <status-code/system_code.hpp>

#include "test_utils.hpp"

Expand Down Expand Up @@ -113,4 +115,12 @@ TEST_CASE("data defined domain returns the correct description")
CHECK(std::string_view(test_code(code).message().data()) == description);
}

TEST_CASE("data defined domain can be put on the heap")
{
cncr::system_error::system_code const subject
= cncr::system_error::make_nested_status_code(
test_code{test_errc::perm});
CHECK(subject == test_errc::perm);
}

} // namespace cncr_tests
8 changes: 4 additions & 4 deletions src/dplx/cncr/disappointment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ template <typename T>
struct status_code_throw_policy
: outcome::experimental::policy::status_code_throw<
T,
system_error::errored_status_code<system_error::erased<
typename system_error::system_code::value_type>>,
system_error::erased_errored_status_code<
typename system_error::system_code::value_type>,
void>
{
};

template <typename R>
using result = outcome::experimental::status_result<
R,
system_error::errored_status_code<system_error::erased<
typename system_error::system_code::value_type>>,
system_error::erased_errored_status_code<
typename system_error::system_code::value_type>,
status_code_throw_policy<R>>;

} // namespace dplx
Expand Down

0 comments on commit f84a709

Please sign in to comment.