zeus_expected: add package (#3753)
* zeus_expected: add package * zeus_expected: change test * zeus_expected: add patch * zeus_expected: fix sha256 of patch * zeus_expected: change test * zeus_expected: change sha256 * zeus_expected: Move `/Zc:__cplusplus` to `on_install` callback * zeus_expected: move `/Zc:__cplusplus` to on_test callbackpull/3755/head
parent
62fc740ce1
commit
fec13704da
2 changed files with 70 additions and 0 deletions
@ -0,0 +1,40 @@ |
||||
diff --git a/include/zeus/expected.hpp b/include/zeus/expected.hpp
|
||||
index 50c286f..fa29889 100644
|
||||
--- a/include/zeus/expected.hpp
|
||||
+++ b/include/zeus/expected.hpp
|
||||
@@ -1778,7 +1778,7 @@ public:
|
||||
{
|
||||
using U = expected_detail::remove_cvref_t<std::invoke_result_t<F, decltype(std::move(this->m_val))>>;
|
||||
static_assert(expected_detail::is_specialization_v<U, expected>, "U (return type of F) must be specialization of expected");
|
||||
- static_assert(std::is_same_v<U::error_type, E>, "The error type must be the same after calling the F");
|
||||
+ static_assert(std::is_same_v<typename U::error_type, E>, "The error type must be the same after calling the F");
|
||||
|
||||
if (has_value())
|
||||
return std::invoke(std::forward<F>(f), std::move(this->m_val));
|
||||
@@ -1790,7 +1790,7 @@ public:
|
||||
{
|
||||
using U = expected_detail::remove_cvref_t<std::invoke_result_t<F, decltype(std::move(this->m_val))>>;
|
||||
static_assert(expected_detail::is_specialization_v<U, expected>, "U (return type of F) must be specialization of expected");
|
||||
- static_assert(std::is_same_v<U::error_type, E>, "The error type must be the same after calling the F");
|
||||
+ static_assert(std::is_same_v<typename U::error_type, E>, "The error type must be the same after calling the F");
|
||||
|
||||
if (has_value())
|
||||
return std::invoke(std::forward<F>(f), std::move(this->m_val));
|
||||
@@ -2469,7 +2469,7 @@ public:
|
||||
{
|
||||
using U = expected_detail::remove_cvref_t<std::invoke_result_t<F>>;
|
||||
static_assert(expected_detail::is_specialization_v<U, expected>, "U (return type of F) must be specialization of expected");
|
||||
- static_assert(std::is_same_v<U::error_type, E>, "The error type must be the same after calling the F");
|
||||
+ static_assert(std::is_same_v<typename U::error_type, E>, "The error type must be the same after calling the F");
|
||||
|
||||
if (has_value())
|
||||
return std::invoke(std::forward<F>(f));
|
||||
@@ -2481,7 +2481,7 @@ public:
|
||||
{
|
||||
using U = expected_detail::remove_cvref_t<std::invoke_result_t<F>>;
|
||||
static_assert(expected_detail::is_specialization_v<U, expected>, "U (return type of F) must be specialization of expected");
|
||||
- static_assert(std::is_same_v<U::error_type, E>, "The error type must be the same after calling the F");
|
||||
+ static_assert(std::is_same_v<typename U::error_type, E>, "The error type must be the same after calling the F");
|
||||
|
||||
if (has_value())
|
||||
return std::invoke(std::forward<F>(f));
|
@ -0,0 +1,30 @@ |
||||
package("zeus_expected") |
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/zeus-cpp/expected") |
||||
set_description("Backporting std::expected to C++17.") |
||||
set_license("MIT") |
||||
|
||||
add_urls("https://github.com/zeus-cpp/expected/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/zeus-cpp/expected.git") |
||||
|
||||
add_versions("v1.0.0", "a0d81798b777f9bfcc1e1e4f3046632067bd8c6071dbfcbec5012a31a5aebc68") |
||||
|
||||
add_patches("v1.0.0", path.join(os.scriptdir(), "patches", "v1.0.0", "fix_typename.patch"), "710d71f8c765a2937df25a2c52abec24f5f4ef5f43281f6aa01853d0498e2a47") |
||||
|
||||
on_install(function (package) |
||||
os.cp("include", package:installdir()) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
local cxflags = {} |
||||
if package:is_plat("windows") then |
||||
table.insert(cxflags, "/Zc:__cplusplus") |
||||
end |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <zeus/expected.hpp> |
||||
void test() { |
||||
zeus::expected<int, int> e1 = 42; |
||||
zeus::expected<int, int> e2 = zeus::unexpected(42); |
||||
} |
||||
]]}, {configs = {languages = "cxx17", cxflags = cxflags}})) |
||||
end) |
Loading…
Reference in new issue