[C++-sig] Wrapping boost::multi_array

David Abrahams dave at boost-consulting.com
Thu Jun 16 12:40:26 CEST 2005


Thomas Kolb <chilavert123 at gmx.net> writes:

> Thomas Kolb schrieb:
>
>> namespace  {
>> 
>> 	typedef boost::multi_array<double, 1> DoubleVector;	
>> 
>> 	DoubleVector* cTorWrapper(unsigned int size)
>> 	{
>> 		return new DoubleVector(boost::extents[size]);
>> 	}
>> 	
>> 	double& operatorWrapper(DoubleVector& vec, DoubleVector::size_type id)
>> 	{
>> 		return vec[0];
>> 	}
>> 
>
> it seems it's not possible to return references (or pointers) to 
> builtin types (like double, int,...) here. Am I right?

That's correct.  Python floats and ints are immutable, so there's no
type that corresponds to a reference-to-double in Python.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list