robotpy / robotpy-build

(mostly) automated C++ wrapping for Python
BSD 3-Clause "New" or "Revised" License
37 stars 16 forks source link

[BUG]: support wrapping template specializations #217

Open virtuald opened 1 year ago

virtuald commented 1 year ago

Problem description

Going to ignore these for now since it causes issues and it'll be annoying to address, but here's what needs to be done?

The example below breaks by overwriting the original template class .hpp

Operating System

Linux

Installed Python Packages

No response

Reproducible example code

#pragma once

// basic template
template <typename T>
struct TBasic
{
    virtual ~TBasic() {}

    T getT() { return t; }
    virtual void setT(const T &t) { this->t = t; }

    T t;
};

// basic specialization
// - TODO: ignored for now since this is annoying
template <>
struct TBasic<int> {
    int add5() { return t + 5; }
};