That wasn't so bad, having done the right preparations
I've implemented it now for my engine::scene class (IO), all working fine, and no problems anymore with the default assignment/ copy operator. Even following the rule of three, DIY destructor not needed anymore.
A few conclusions/ thaughts:
- I assume there's nothing to do with a vector in my constructor (not setting to NULL or so)
- vector.reserve function is useless when I simply use vector.resize, because in my/ this case I know the exact number/ size
(if I append an object later on, I'll just use 'push back' and it will reserve space for me anyway)
- no forward declarations possible anymore in my header files of the class, because the vector types are no longer pointers
(more includes needed in header file)
- for loops get less readable when using vector.size, returns a vector<int>::size_type instead of regular int
example: for(vector<int>::size_type mi=0;mi<mMeshInstances.size();++mi)
I might consider to use iterators later on, but for now this works fine (no signed/unsigned warnings)
Struggle; when going through my scene file the 1st time and count the needed sizes for lights, meshes, etc etc., I have to save these numbers. So basically I'm using both my member variabel int's to find number of meshes, lights etc.. But afterwards I can use vector.size() to go through all objects. Not sure how I can eliminate having the int's as member vars having the same value as the vector's.size(). Unless I change my allocate memory function with a huge number of input parameters).
Any input is appreciated as always.