robotpy-build icon indicating copy to clipboard operation
robotpy-build copied to clipboard

[BUG]: support wrapping template specializations

Open virtuald opened this issue 2 years ago • 0 comments

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?

  • needs to include __classname.hpp
  • use bind___classname(m, name) as a member variable
  • from it's bind__classname_specialization needs to call the bind___classname methods in addition to doing whatever binding it needs to do
  • require 'rename' (generate an auto name in create-gen?)

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; }
};

virtuald avatar Oct 22 '23 05:10 virtuald