Skip to content

Commit

Permalink
Added static assert to check if all the struct fields are compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Apr 4, 2022
1 parent 0923a53 commit a94caa1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/matioCpp/impl/ExogenousConversions.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ inline matioCpp::Struct matioCpp::make_variable(const std::string& name, const S

visit_struct::for_each(input,
[& matioStruct](const char * name, const auto & value) {
static_assert (is_make_variable_callable<decltype(value)>::value, "The input struct contains non-compatible fields.");
bool ok = matioStruct.setField(make_variable(name, value));
matioCpp::unused(ok);
assert(ok);
Expand Down

0 comments on commit a94caa1

Please sign in to comment.