Skip to content

The necessity of exporting base virtual function in 06-VirtualFunctionsInPython #41

@ivytin

Description

@ivytin

In

.def("name", &Base::name, &BaseWrap::default_name)

I knew the boost python doc said

Take note that we expose both &Base::f and &BaseWrap::default_f. Boost.Python needs to keep track of 1) the dispatch function f and 2) the forwarding function to its default implementation default_f. There's a special def function for this purpose.

But is it truely necessary to export &Base::name? And I can't see the differences blow in running results:

.def("name", &Base::name, &BaseWrap::default_name)
.def("name", &BaseWrap::default_name)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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