Skip to content

Commit

Permalink
Add simplified call operator() to Variant in C++ API
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Aug 15, 2024
1 parent 93b9b06 commit f9dbf7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions program/cpp/api/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ struct Variant
template <typename... Args>
Variant call(Args... args);

template <typename... Args>
Variant operator ()(const std::string &method, Args... args);

static void evaluate(const Operator &op, const Variant &a, const Variant &b, Variant &r_ret, bool &r_valid);

Variant &operator=(const Variant &other);
Expand Down Expand Up @@ -578,3 +581,8 @@ inline Variant Variant::call(Args... args) {
callp("call", vargs.data(), vargs.size(), result, error);
return result;
}

template <typename... Args>
inline Variant Variant::operator ()(const std::string &method, Args... args) {
return method_call(method, args...);
}

0 comments on commit f9dbf7e

Please sign in to comment.