title: String concatenation C++
body: <p>Given an arbitrary floating point number, say <code>-0.13</code>, suppose we have an algorithm which calculates a binary string of known length <code>L</code> for this number, one by one, from left to right. </p>
  
  <p>(I need to do this computation for calculating the Morton Key ordering for particles(co-orindates given) which in turn in used in building octrees. I am creating 
  such binary strings for each of x,y,z dimensions)</p>
  
  <p>Is it better/efficient to first create a character array of length <code>L</code>, and then convert this array into a string? i.e.</p>
  
  <pre><code>char ch[L];
  
  for(i = 0; i &lt; L; ++i)
  {
      // calculation of ch[i]
  }
  
  //convert array into string
  </code></pre>
  
  <p>Or is it better/efficient to start of with a empty string, and then concatenate a new calculated bit into the string on the fly. i.e. </p>
  
  <pre><code>string s = "";
  
  for(i = 0; i &lt; L; ++i)
  {
      // calculation of ch[i]
      s = s + string(ch);
  }
  </code></pre>