[C++-sig] To Roman Yakovenko - a question about boost python

Chang Chen Chang_Chen at sonic.com
Mon Oct 22 09:05:17 CEST 2007


Hi Roman Yakovenko

Do you think what I think on out parameter is ok or not?

Any suggestion?

- Chang

-----Original Message-----
From: c++-sig-bounces+chang_chen=sonic.com at python.org
[mailto:c++-sig-bounces+chang_chen=sonic.com at python.org] On Behalf Of
Chang Chen
Sent: Wednesday, October 17, 2007 11:38 AM
To: c++-sig at python.org
Subject: [C++-sig] a question about boost python

I know we need define a wrapper, but our function signature is quite
regular. i.e. only the last parameter is output parameter, so I want to
write a template, so that such wrapper can be easily written.

Our function definition looks like:

    void function1(int  t1, float t2, string& t3) ;

I want to define a template:

template <typename Return, typename T1, typename T2, typename TOUT> 
 struct FunctionConvert< Return (*) ( T1 , T2, TOUT& ) >
{
	typedef functionT	Return (*) ( T1 , T2, TOUT& );
	static TOUT run(functionT P,const T1& t1, const T2& t2)
	{
		TOUT out;
		P(t1,t2,out);
		return out;
	}
}

But I do not know how to integrate it with boost python :(.

- Chang

_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig



More information about the Cplusplus-sig mailing list