Boost help please

Jim REMOVEjimdon at sympatico.caREMOVE
Thu Mar 20 09:55:26 EST 2003


Cool that looks easy enough ... thank you ...

Ben Hutchings wrote:
> In article <_fjea.3599$j5.16816 at news>, Jim wrote:
> 
>>Hi,
>>
>>I am switching some C++ code over to use boost ... but i am having some 
>>problems just getting things to compile ... the compile error is not 
>>very helpful so i'll leave it out for now ... the problem i think is 
>>more related to the fact i need return a structure from a boost function 
>>.... can anyone help ;-)
> 
> 
> Assuming that you're using version 2 of Boost.Python, you should use the
> tuple wrapper class.
> 
> I'm just a beginner with Boost.Python myself, but I think this should work:
> 
>     return boost::python::make_tuple(
>         theboard.x60_clk/1e6, 
>         theboard.pwm_clk/1e6,
>         theboard.utx_clk/1e6,
>         theboard.urx_clk/1e6,
>         theboard.local_ref_clk/1e6,
>         theboard.pcr_ref_clk/1e6,
>         theboard.mod_ref_clk/1e6,
>         theboard.demod_ref_clk/1e6,
>         theboard.mod_utopia,
>         theboard.demod_utopia,
>         theboard.dac_type,
>         theboard.adc_type);
> 
> Consider defining a new Python class/type to hold all these values, as
> code that accesses the anonymous members of a large tuple can be quite
> hard to read and maintain.





More information about the Python-list mailing list