Skip to content

Handling T* and T& of function parameter #4

@edimetia3d

Description

@edimetia3d

When a function uses T* (or T & ) as a parameter, this function will usually want to modify the object it pointed to, e.g.

ErrorCode GetValue(int * v);
ErrorCode GetValue(std::vector<int> * vec);

However:

  1. Python itself does not support mutable int
  2. pybind11 will create a copy when T is a std container type, any modification to the copied object will not return to python runtime.

These cases should be handled automatically, or at least a warning should be printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions