I want to use std::vector for dynamically allocating memory. The scenario is:
int neededLength = computeLength(); // some logic here // this will allocate t
As already said, no.
The reason is that &buffer[0] is the only way guarantied by the standard to get the adresse of the vector buffer.