Skip to content

Commit

Permalink
bug fix: fdapde::invoke to recive argument pack by rvalue reference, …
Browse files Browse the repository at this point in the history
…not by copy (which caused passed objects to be default intialized at invoke time)
  • Loading branch information
AlePalu committed Jan 22, 2024
1 parent d13bc31 commit bb6063a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fdaPDE/utils/type_erasure.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ template <typename StorageType, typename... I> class erase : vtable_handler, pub
};

// invoke function pointer (T is deduced to the type of the interface)
template <typename RetType, int N, typename T, typename... Args> RetType invoke(const T& obj, Args... args) {
template <typename RetType, int N, typename T, typename... Args> RetType invoke(const T& obj, Args&&... args) {
auto& vtable = reinterpret_cast<const vtable_handler&>(obj);
short offset = vtable.offset_table_.at(typeid(std::decay_t<T>)) + N;
return reinterpret_cast<RetType (*)(const void*, Args...)>(vtable.vtable_[offset])(vtable.__data(), args...);
Expand Down

0 comments on commit bb6063a

Please sign in to comment.