GeAutoDynamicArray question
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/03/2011 at 14:01, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;---------
Is it possible to create an array of my own class using GeAutoDynamicArray<MyClass> myArray;?
When I try it I get an error stating that there is no acceptable contructor for TYPE = MyClass
Here's the error:
\>c:\program files\maxon\cinema 4d r12 demo\resource\_api\ge_dynamicarray.h(708) : error C2512: 'MyClass' : no appropriate default constructor available 1> c:\program files\maxon\cinema 4d r12 demo\resource\_api\ge_dynamicarray.h(665) : while compiling class template member function 'Bool GeDynamicArray<TYPE>::ReScope(VLONG)' 1> with 1> [ 1> TYPE=MyClass 1> ] 1> c:\program files\maxon\cinema 4d r12 demo\resource\_api\ge_dynamicarray.h(1238) : see reference to class template instantiation 'GeDynamicArray<TYPE>' being compiled 1> with 1> [ 1> TYPE=MyClass 1> ]
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/03/2011 at 16:25, xxxxxxxx wrote:
You must declare as a pointer like this:
GeDynamicArray<LibraryItem*> items;
Then you need to ALLOCATE a new instance and push it into the array. Doesn't work any other way as my experience goes.
LibraryItem* li = gNew LibraryItem;
if (!li) return ErrPrt("Greebler.Library.LoadItem.li failed!");
items.Push(li);Use .Free() to clear and .Count() to get the number of array elements.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/03/2011 at 16:53, xxxxxxxx wrote:
Thanks Robert.. Not sure why didn't think of making it a pointer HAHAHA... I appreciate your help.
~Shawn