Is it good practice to use std::vector as a simple buffer?

后端 未结 8 619
慢半拍i
慢半拍i 2021-01-31 07:41

I have an application that is performing some processing on some images.

Given that I know the width/height/format etc. (I do), and thinking just about defining a buffer

8条回答
  •  感情败类
    2021-01-31 08:07

    std::vector was MADE to be used in such cases. So, yes.

    1. Yes, it is.

    2. reserve is unnecessary in your case.

    3. Yes, it will.

提交回复
热议问题