BaseArray access problem [SOLVED]
- 
					
					
					
					
 On 06/07/2014 at 22:19, xxxxxxxx wrote: User Information: 
 Cinema 4D Version: 14
 Platform: Windows ;
 Language(s) :--------- 
 Hi
 I am creating a BaseArray:
 c4d_misc::BaseArray<Vector> MyVectorArrayIf I try to pass it to a function, the compiler throws an error: 
 'c4d_misc::BaseArray<T>::BaseArray' : cannot access private member declared in class 'c4d_misc::BaseArray<T>'I can pass a GeDynamicArray to a function without problems, but I would like to use BaseArray for its speed. So basically, how do I pass a BaseArray to a function. 
- 
					
					
					
					
 On 08/07/2014 at 12:57, xxxxxxxx wrote: No hint on passing a BaseArray to a function? c4d_misc::BaseArray<Vector> MyVectorArray; MyVectorArray.Resize(10); for (int i=0; i<10; i++) MyVectorArray[i] = Vector(0,i,0); GePrint(RealToString(MyVectorArray[5].y)); //5 This works!!! printVectorBaseArray(MyVectorArray); //DOES NOT WORK....BaseArray is Inaccessible!!! void printVectorBaseArray(c4d_misc::BaseArray<Vector> inputVectorArray) { GePrint(RealToString(inputVectorArray[5].y)); }
- 
					
					
					
					
 On 08/07/2014 at 13:51, xxxxxxxx wrote: It protects you from passing the array by value, which is what you are doing. The function call 
 would require to copy the whole array. Pass it as a pointer or reference (usually preferred).void printVectorBaseArray(c4d_misc::BaseArray<Vector> **&** inputVectorArray) { GePrint(RealToString(inputVectorArray[5].y)); }-Niklas 
- 
					
					
					
					
 On 08/07/2014 at 15:18, xxxxxxxx wrote: It works. Thanks Niklas! 
- 
					
					
					
					
 On 09/07/2014 at 08:19, xxxxxxxx wrote: But please do not forget about const if the array do NOT need to be modified inside function. void printVectorBaseArray( **const** c4d_misc::BaseArray<Vector> **&** inputVectorArray) { GePrint(RealToString(inputVectorArray[5].y)); }
- 
					
					
					
					
 On 09/07/2014 at 11:18, xxxxxxxx wrote: That's a good tip, thanks Remo!