autocxx
autocxx copied to clipboard
Subtype polymorphism
As part of my bachelorthesis I worked on exending Autocxx's support for polymorphism, specifically subtype polymorphism.
This allows non-virtual methods to be called on child class objects as well as using child class references as baseclass refernce parameters values.
Currently only 75% of the tests are passing so I wanted to get an image of if you think this is worth fixing up.
The way I implemented it was as post processing after the last step before codegen: Methods get implemented on a extension trait which is implemented for all childclasses. Furthermore functions with reference parameters get wrapped in a function that takes a impl-type parameter.
This process is currently disabled for virtual functions with reference parameters.
For examples of what this allows please check out: https://git.yasupa.de/jasper3108/BA-2/src/branch/master/Abgabe/ch7/src/main.rs and https://git.yasupa.de/jasper3108/BA-2/src/branch/master/Abgabe/ch7/src/header.hpp for the C++ code.
My CLA is already applied but im still waiting for it.
Jasper W.