title: converting a variable name to a string in C++
body: <p>I'd like to output some data to a file. For example assume I have two vectors of doubles: </p>
  
  <pre><code>vector&lt;double&gt; data1(10);
  vector&lt;double&gt; data2(10); 
  </code></pre>
  
  <p>is there an easy way to output this to a file so that the first row contains the headings 'data1' and 'data2' followed by the actual contents. The function which 
  outputs the data will be passed various different arrays so hardcoding the name 
  of the heading is not possible - ideally I'd like to convert the variable name 
  to some string and then output that string followed by the contents of the vector array. However, I'm not sure how to convert the variable name 'data1' to a string, 
  or indeed if it can easily be done (from reading the forums my guess is it can't) 
  If this is not possible an alternative might be to use an associative
  container such as map or perhaps more simply a 'pair' container. </p>
  
  <pre><code>pair&lt;vector&lt;double&gt;,string&gt; data1(10,'data1');  
  </code></pre>
  
  <p>Any suggestions would be welcome!</p>