title: how to nth element of set
body: <p>how to get the value of Nth element of set directly</p>
  
  <pre><code>#include &lt;bits/stdc++.h&gt;
  using namespace std;
  int main(){
    set&lt;int&gt; a;
    a.insert(1);
    a.insert(2);
    a.insert(3);
    a.insert(4);
    a.insert(5);
    cout &lt;&lt; ans[4] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I want '4' as an output without iterating over a loop 4 times with iterator.
  Is there a pre-defined way to get nth element of a set.</p>
  
  <p>" error: no match for ‘operator[]’ (operand types are ‘std::set’ and ‘int’)"</p>