Skip to content

Commit

Permalink
Support deserialization of both const and mutable function pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
asoffer committed Feb 8, 2024
1 parent 98ebed2 commit c6f9bf1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jasmin/core/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ struct ProgramDeserializer {
return nth::io::deserialize_fixed(d, x);
}

friend bool NthDeserialize(std::derived_from<ProgramDeserializer> auto &d,
Function<> const *&fn) {
uint32_t index;
if (not nth::io::deserialize_fixed(d, index)) { return false; }
if (index >= d.registered_functions_.size()) { return false; }
fn = d.registered_functions_[index];
return true;
}

friend bool NthDeserialize(std::derived_from<ProgramDeserializer> auto &d,
Function<> *&fn) {
uint32_t index;
Expand Down

0 comments on commit c6f9bf1

Please sign in to comment.