title: std::string or std::vector<char> to hold raw data
body: <p>I hope this question is appropriate for stackoverflow... What is the difference between storing raw data bytes (8 bits) in a <code>std::string</code> rather than storing them in <code>std::vector&lt;char&gt;</code>. I'm reading binary data from a file and storing those raw bytes in a <code>std::string</code>. This works well, there are no problems or issues with doing this. My program works as expected. However, other programmers prefer the <code>std::vector&lt;char&gt;</code> approach and suggest I stop using <code>std::string</code> as it's unsafe for raw bytes. So I'm wondering why might it be unsafe to use <code>std::string</code> to hold raw data bytes? I know <code>std::string</code> is most often used to store ASCII text, but a byte is a byte, so I don't understand the preference of the <code>std::vector&lt;char&gt;</code>.</p>
  
  <p>Thanks for any advice!</p>