I have used initialization lists a great deal in my C++ programs but wasn\'t aware that you could allocate memory within them.
So you can do something (as a contrive
There's no problem with your initialization -- they are guaranteed by the standard to be done in order, however, do remember that if any of those allocations fails, the former ones won't be freed.
So the only downside is if you want to keep safe against a failed allocation -- then you'd rather want to initialize them to nil and in the constructor wrap the allocation up in a try block. That is usually not needed though, unless your application is in the real danger of running out of memory, and needs to recover from that.
Of course that holds true assuming that only a lack of memory can throw an exception -- if you allocate objects that can throw other exceptions, you should be more worried about it.