Let me use as example a vector object but it applies to any object.
Is it safe to create an object as
MyVector xyz(std::vector(10));
assuming that there is a constructor which take as input a std::vector?
I have been told that this is wrong because the vector is immediately released. However, to me it seems correct as i’m using it to create my own vector xyz. Looks like a copy constructor.
Many thanks
Albert is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.