C++ Converting Vector items to single String Error?
<p>So I have a function, where <code>KaylesPosition</code> is a class with a <code>vector&lt;int&gt;</code> called <code>piles</code>:</p>

<pre><code>// Produces a key to compare itself to equivalent positions     
std::string KaylesPosition::makeKey(){
  std::vector&lt;int&gt; temp(piles.size());
  for (int i = 0;i&lt;piles.size();i++){
    temp[i]=piles[i];
  }

  std::sort (temp.begin(),temp.end());
  std::string key = "" + temp.at(0);
  for (int i=1 ; i&lt;temp.size() ; i++){
    key.push_back('.');
    key.push_back(temp.at(i));
  }

  return key;
}
</code></pre>

<p>My expected output should be all of the elements in <code>piles</code> in order, separated by periods. However instead, I get <code>key</code> return as "_M_range_check". I have tried this using std::string.append() and I get either an empty string or a period. How do I get this function to return a string of all of the values in <code>piles</code> as expected?</p>
