mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 03:45:30 +07:00
safe_invoke, safe_get_as, safe_create
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user