Hi!
I’m trying out the Reflex library.
I have some trouble calling overloaded member functions using Reflex.
Here is what I tried. I wrapped the following class:
class MyClass {
public:
MyClass() {}
~MyClass() {}
int f() { return 10; }
int f(int x) { return 11; }
int f(int x, int y) { return 12; }
};
Then I ran the following code:
[code] #include
#include
#include <Reflex/Object.h>
#include <Reflex/Type.h>
using namespace std;
using namespace Reflex;
int main()
{
Type t = Type::ByName("MyClass");
Object o = t.Construct();
int m = 0;
vector<void*> args;
args.push_back(&m);
int n = 0;
o.Invoke("f", Type::ByName("int(int)"), n, args);
std::cout << n << std::endl;
}[/code]
It produced the output 10.
I had expected the output 11.
What am I doing wrong?
I’m using a Reflex distribution named reflex-2013-08-14.tar.bz2.
Also, is there any documentation that explains this?
The documentation I could find was very brief,
and had no examples with overloaded functions.
Thank you,
Johan Råde