title: Converting std::string to std::vector<char>
body: <p>I am using a library which accepts data as a <code>vector</code> of <code>char</code>s. I need to pass a <code>string</code> to the library.</p>
  
  <p>I think about using <code>std::vector</code> constructor which accepts iterators to carry out the conversion - but wondered if there is a better way of doing it?</p>
  
  <pre><code>/*Note: json_str is of type std::string*/
  const std::vector&lt;char&gt; charvect(json_str.begin(), json_str.end()); 
  </code></pre>