safe_invoke, safe_get_as, safe_create

This commit is contained in:
BlackMATov
2023-02-12 02:15:27 +07:00
parent deeaebd6a6
commit 4bfde4b1fb
32 changed files with 851 additions and 472 deletions

View File

@@ -65,7 +65,7 @@ TEST_CASE("meta/meta_manuals/member/usage") {
CHECK(ivec2_x_typed_value == 42);
// also, we can change the member value, of course
ivec2_x.set(v, 11);
CHECK(ivec2_x.safe_set(v, 11));
// checks the result of our manipulations
CHECK(v.x == 11);

View File

@@ -40,7 +40,7 @@ TEST_CASE("meta/meta_manuals/variable/usage") {
CHECK(pi_variable_value.get_as<double>() == doctest::Approx(3.14).epsilon(0.01));
// we can change variable values, but only non-const
CHECK_THROWS(pi_variable.set(6.0));
CHECK_FALSE(pi_variable.safe_set(6.0));
// prints all variables in the scope
fmt::print("* {}\n", constants_scope.get_name());