title: Reorganize the content of a vector
body: <p>I would like to reorganize the contents of a vector to start with this for example:</p>
  
  <pre><code>// 'v' is the vector
  
  v[0]: "name: "
  v[1]: &amp;
  v[2]: "James"
  v[3]: &amp;
  v[4]: 10
  v[5]: &amp;
  v[6]: "last name: "
  v[7]: &amp;
  v[8]: "Smith"
  </code></pre>
  
  <p>and get to this:</p>
  
  <pre><code>v[0]: "name: " &amp; "James" &amp; 10 &amp; "last name: " &amp; "Smith"
  </code></pre>
  
  <p>This example is very basic.</p>
  
  <p>I tried something like that:</p>
  
  <pre><code>std::vector&lt;std::string&gt; organize(std::vector&lt;std::string&gt; tokens) {
          using namespace std;
          vector&lt;string&gt; ret;
          string tmp;
          // The IsString function checks whether a string is enclosed in quotation marks.
          // The s_remove_space function removes spaces from a character string.
          for (string str : tokens) {
              if (IsString(str) || str == tokens[tokens.size() - 1]) {
                  ret.push_back(tmp);
                  ret.push_back(str);
                  tmp.clear();
              }
              else if (s_remove_space(str) != "")
                  tmp += str;
          }
          return ret;
      }
  </code></pre>
  
  <p>The output is the same as the input, if we take my example from above.
  Besides, my way of doing things seems pretty brutal. I guess it's pretty simple to implement with a RegEx system, but I can't / don't want to use them.</p>
  
  <p>Debugging VC++ step-by-step on my project doesn't help me solve the problem. This one seems to me to be very simple to solve...</p>
  
  <p>In my opinion, the mistake is silly, but I've been looking for it for quite some time.</p>