Skip to content

Conversation

@Vipul-Cariappa
Copy link
Collaborator

TODO:

  • Add new test for this change

The following should be sufficient:

import cppyy

cppyy.cppdef(
    r"""
#include <utility>
#include <iostream>
#include <string>

void foo() { std::cout << "foo!\n";}

void bar(int a, float b) { std::cout << "bar(" << a << "," << b << ")\n"; }

template <typename T, typename U>
void baz(T a, U b, std::string c) { std::cout << "baz(" << a << "," << b << ",\"" << c << "\")\n"; }

template<typename F, typename... Args>
void dataframe_define_mock(F callable, Args&&... args) {
    callable(std::forward<Args>(args)...);
}
"""
)

cppyy.gbl.dataframe_define_mock(cppyy.gbl.foo)
cppyy.gbl.dataframe_define_mock(cppyy.gbl.bar, 42, 11.11)
cppyy.gbl.dataframe_define_mock(cppyy.gbl.baz[int, float], 33, 101.101, "hello")

Copy link

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants