title: std::set for each element in an array
body: <p>I need a functionality of <code>std::set</code> for each element in an array. How can I achieve this functionality?</p>
  
  <p>I started with allocating dynamic array of std set in C++ as follows:</p>
  
  <pre><code>set&lt;int&gt;* entry;
  </code></pre>
  
  <p>followed by allocation:</p>
  
  <pre><code>entry = (set&lt;int&gt;*)malloc(sizeof(set&lt;int&gt;)*32);
  </code></pre>
  
  <p>No compilation problem, but the runtime fails with segmentation fault when any element is accessed:</p>
  
  <pre><code>entry[0].insert(23);
  </code></pre>
  
  <p>Any help is highly appreciated.</p>