[C++-sig] Re: How to turn output parameters to return values?

Matthias Baas baas at ira.uka.de
Fri Feb 20 16:35:12 CET 2004


Pierre Barbier de Reuille wrote:
> I think you should write a thin wrapper like :

Ah, ok, thanks! I thought there might be a mechanism to do that 
automatically.

> But I don't understand why you need to return a reference ! However, you
> can't return a reference on an integral type, because Python doesn't
> allow that.

Sorry, I didn't want to return a reference.... what I meant is this: If 
I have a function like this:

void foo(int x);

I could write a wrapper using return_arg<>() that actually returned the 
value of x. But of course, in such a case foo() can't return a value 
through this variable. What I wanted was this:

void foo(int& x);

But then the return_arg<>() didn't work anymore (I still only want the 
value of x, not a reference to x. But I suppose the wrapper still 
expected the x as input...).


- Matthias -





More information about the Cplusplus-sig mailing list