Sorry for the headline I wasn't sure how to correctly express my problem. I have a class that does generate an array based on a certain algorithm. The array length may vary so I'd like to allocate the array dynamically. The caller - of course - wants to access this array using a getter where I return the reference to the array. My question:
Is there a rule or a good practice if I either let the user allocate / de-allocate the resource and just let him pass the resource to my class and act on this or will I take care of the allocation / de-allocation (RAII) in order to prevent memory leaks?
Any help is appreciated!