Why would i use a UTILITY as opposed to a STRUCT?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2236182/what-is-the-difference-between-using-a-struct-with-two-fields-and-a-pair">What is the difference between using a struct with two fields and a pair?</a>  </p>
</blockquote>



<p>I been looking through a c++ quick reference app and noticed the UTILITY data structure <code>pair&lt; TypeName, TypeName&gt;</code> to store a pair of variables in what i would think a struct. I'm confused on why this would be implemented as opposed to just using a simple struct, could someone enlighten me on why pair might be of any use?</p>

<pre><code>pair&lt;string, int&gt; a("hello",3); // A 2-element struct
a.first;  //"hello"
a.second; //3
</code></pre>

<p>I would think using a struct would be a better practice, as you can look back on the struct type and create objects of that specific struct while <code>pair</code> could be prone to simple mistakes if multiple copies were needed. </p>

<pre><code>struct Data
{
    string str;
    int num;
}

Data pair1;
pair1.str = "hello";
pair1.num = 3;
</code></pre>
