Should I always call vector clear() at the end of the function?

后端 未结 5 692
灰色年华
灰色年华 2020-12-08 14:34

I have some simple function that uses vector like this (pseudo code):

void someFunc(void) {

    std::vector contentVector;

    // here a         


        
5条回答
  •  [愿得一人]
    2020-12-08 15:00

    No need, it will get cleared automatically once it is out of scope i.e destructor will destroy the container object.

提交回复
热议问题