1

C++ why double pointer for out/return function parameter?

I was looking at this example and thought of how to implement this particular function in Cython.

It is a C++ function which takes a double pointer as an input for the purpose of pass by reference.

void Foo(MyClass **x){
    *x = new MyClass();
}

Anyone has any thoughts how it should be wrapped in Cython?

Community
  • 1
  • 1
user279545
  • 123
  • 1
  • 8
  • 1
    In Python as well as in C++, a function producing a single object should just return that object. – Cheers and hth. - Alf Mar 02 '15 at 16:46
  • I C/C++ you pas a double pointer as argument to a function when you want to change what that pointer points to. In higher level languages (like Java or python) you don't have this issue because there's no such thing as pointers – Pandrei Mar 02 '15 at 16:53

0 Answers0