title: How to split a hex string into std::vector?
body: <p>Given a hex <code>std::string</code> like <code>"09e1c5f70a65ac519458e7e53f36"</code>, how can I split it in chunks of two digits and store them into an <code>std::vector&lt;uint8_t&gt;</code>?</p>
  
  <p>I loop over the string in steps of the chunk size, but I don't know how to convert the hex chunk into a number. This is what I have so far.</p>
  
  <pre><code>vector&lt;byte&gt; vectorify(string input, int chunk = 2)
  {
      vector&lt;uint8_t&gt; result;
      for(size_t i = 0; i &lt; input.length(); i += chunk)
      {
          int hex = input.substr(i, chunk);
          // ...
      }
      return result;
  }
  </code></pre>