Skip to content

how to overwrite parent class's enum with same name? #1624

Description

@steve3d

Issue description

I'm binding a complex c++ library to python, in this lib, it has many inheritance, and for example

class A {
public:
     enum AEnum{...}
}

class B: public A {
public:
     enum AEnum{...}
}

in child class, there is a enum with exact same name with parent class, but it has different values. so in my binding code, I can bind these enum to each class, it compiles fine, but when in python, if I use import testmodule, then it throws an error about that AEnum is already defined.

So How could I export these different enums with same name, but in different class?

PS: I didn't use py::enum_<xx>().export_values(), I don't want any of these enum values in my root module.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions