Function hiding and using-declaration in C++ : <p>My confusion comes from "C++ Primer 5th edition" section 13.3, page 518.</p>

<blockquote>
  <p>Very careful readers may wonder why the <code>using</code> declaration inside <code>swap</code> does not hide the declarations for the <code>HasPtr</code> version of <code>swap</code>.</p>
</blockquote>

<p>I tried to read its reference but still did not understand why. Could anyone explain it a little bit please? Thanks. Here is the code sample of the question.</p>

<p>Assume class <code>Foo</code> has a member named <code>h</code>, which has type <code>HasPtr</code>.</p>

<pre><code>void swap(HasPtr &amp;lhs, HasPtr &amp;rhs)
{...}

void swap(Foo &amp;lhs, Foo &amp;rhs)
{
    using std::swap;
    swap(lhs.h, rhs.h);
}
</code></pre>

<p>Why <code>swap</code> for <code>HasPtr</code> is not hidden which seems to be declared in outer scope while <code>using std::swap</code> is in the inner scope? Thanks.</p>
