title: Getting ambiguous error for Vector. How to Fix it?
body: <pre><code>#include &lt;bits/stdc++.h&gt;
  using namespace std;
  const int N = 1e5 + 10;
  
  vector&lt;int&gt; parent(N);
  vector&lt;int&gt; rank(N); // size
  void make(int v)
  {
     parent[v] = v;
     rank[v] = 1;//&quot;rank&quot; is ambiguous
  }
  int find(int v)
  {
      if (v == parent[v])
      return v;
  
      return parent[v] = find(parent[v]);
  }
  void Union(int a, int b)
  {
      a = find(a);
      b = find(b);
      if (a != b)
      {
          if (rank[a] &lt; rank[b]) //&quot;rank&quot; is ambiguous
              swap(a, b);
          parent[b] = a;
          rank[a] += rank[b];//&quot;rank&quot; is ambiguous
      }
  }
  </code></pre>
  <p>So I was doing Disjoint Union Set (DSU) Data structures in C++. My <code>vector&lt;int&gt; parent</code> is not showing any error but <code>vector&lt;int&gt; rank</code> is showing error of being ambiguous. Why am i getting error:</p>
  <pre class="lang-none prettyprint-override"><code>source&gt;: In function 'void make(int)':
  &lt;source&gt;:10:4: error: reference to 'rank' is ambiguous
     10 |    rank[v] = 1;//&quot;rank&quot; is ambiguous
        |    ^~~~
  In file included from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/move.h:57,
                   from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/stl_pair.h:59,
                   from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:64,
                   from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/specfun.h:45,
                   from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/cmath:1927,
                   from /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/x86_64-linux-gnu/bits/stdc++.h:41,
                   from &lt;source&gt;:1:
  /opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/type_traits:1319:12: note: candidates are: 'template&lt;class&gt; struct std::rank'
   1319 |     struct rank
        |            ^~~~
  &lt;source&gt;:6:13: note:                 'std::vector&lt;int&gt; rank'
      6 | vector&lt;int&gt; rank(N); // size
        |             ^~~~
  </code></pre>
  <p>Why am I getting this error?.</p>
  <p>How do I Fix it ?</p>