On 22/11/2016 at 12:55, xxxxxxxx wrote:
Thank you Remotion, Niklas. I have to admit that it never crossed my mind that the main class (dummy) would be tho one to apply the maxon trickery. I read the following in the sdk:
In the API there are strict requirements as to how classes need to be implemented, so that they can function e.g. with sort and array templates.
To me it meant that whatever custom classes i wanted in insert INTO maxon arrays had to implement the techniques outlined in the sdk for the copy/move/assignment, not custom classes that have maxon arrays as members.
In any case, for now the std::vector class works well - at least for the prototyping stage. Remotion, i am not copying the vectors anywhere, but i am using std::move() in parts, which doesn't affect performance all that much.
I am thinking that before release i could convert all my std::vector's to maxon::BaseArray's, if they don't cause any headaches.
here's a generalization of what i'm doing:
class Container{
public:
std::vector<A> as;
std::vector<B> bs;
//data, constructors, functions
//
//etc.
};
class A{
public:
Container * container;
std::vector<B*> b_ptrs;
//data, constructors, functions
//
//etc.
};
class B{
public:
Container * container;
std::vector<A*> a_ptrs;
//data, constructors, functions
//
//etc.
};
so i have a container that holds arrays of custom objects. each object has a pointer to a container, and is an array of pointers to other objects in the container. It's a special case of linked lists.
As i said, it works well with std::vector's. Would I be able to do this with maxon::BaseArray's?