title: Need some help about "swap" function in c++
body: <p>I am new to C++ programming. I am trying to compile another person's program, and the software reported a bug that I don't know how to solve (the software I use is Visual Studio 2019).</p>
  <p>The line of code with bug is:</p>
  <pre><code>swap(allBeamPoints, unordered_map&lt;int, vector&lt;LidarPoint&gt;&gt;());
  </code></pre>
  <p>The definition for variable <code>allBeamPoints</code> is:</p>
  <pre><code>unordered_map&lt;int, vector&lt;LidarPoint&gt;&gt;allBeamPoints
  </code></pre>
  <p>The error information is:</p>
  <pre><code>Error   C2665   'std::swap': none of the 2 overloads could convert all the argument types   
  </code></pre>
  <p>and</p>
  <pre><code>Error (active)  E0304   no instance of overloaded function &quot;swap&quot; matches the argument list 
  </code></pre>
  <p>However, if I type the following codes, no bug will be reported:</p>
  <pre><code>unordered_map&lt;int, vector&lt;LidarPoint&gt;&gt; allBeamPoints_new;
  
  swap(allBeamPoints, allBeamPoints_new);
  </code></pre>
  <p>Does anyone know what the problem is? Did I fail to link some of the required libraries? How should I check those libraries?</p>