This is illegal, but not for the reasons you think about.
The difference between std::malloc()/ std::free()and new/ deleteis that the latter will call constructors / destructors, and the former will not. Expression
void* p = std::malloc(sizeof(run_male_walker_struct))
will return blob of uninitialized memory on which the constructor is not called. You should not touch it with a ten-foot pole - with the exception of calling the constructor on it:
run_male_walker_struct* pw = new(p) run_male_walker_struct;
If you do this, you will also have to do the opposite:
pw->~run_male_walker_struct();
before freeing up memory:
std::free(p);
, .
- (, ). , . new delete . , std::vector .