Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make configurable whether to generate bindings for referent/pointer return type without return_value_policy specification #279

Open
jslee02 opened this issue Apr 11, 2020 · 0 comments

Comments

@jslee02
Copy link
Member

jslee02 commented Apr 11, 2020

This is a restriction for Boost.Python, but not for pybind11 as pybind11 uses default policy when not provided (see return_value_policy::automatic[_reference] in this doc).

For example, pybind11 allows to generate bindings for getName() with no return value policy specification:

struct Pet {
    Pet(const std::string &name) : name(name) { }
    void setName(const std::string &name_) { name = name_; }
    const std::string &getName() const { return name; }

    std::string name;
};

Possible solution would be introducing a tag in options to specify default return value policies for pointer, const pointer, reference, and const reference. This way we could reduce the number of return value policy specification per types (see this example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant