On 18/02/15 05:13 PM, Christopher O'Grady wrote:
> Hi,
>
> Based on websearches we have done, we believe that boost-python does
> not allow passing arguments by non-const-reference (at least, not
> easily).  Can someone confirm this is still the case, or point me to
> some documentation that discusses it?  We think this prevents us from
> return multiple arguments from a method call.
>
> Looking through the mailing list archives, we believe this is
> impossible.  If someone knows differently can you let us know?

If I understand your question, you aren't so much asking about const vs.
non-const arguments, but rather passing by value vs. passing by reference.
Whenever I want to return multiple values, I write a wrapper function
that packs the return values into a tuple, making the interface more
pythonic. For example:


void func(int input, int &out1, int &out2);

tuple pyfunc(int input)
{
  int out1, out2;
  func(input, out1, out2);
  return make_tuple(out1, out2);
}

...
and then wrap pyfunc instead of func.

Does this address the problem you are trying to solve ?


        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to