all foo with T == P
  }
  </code></p>

<p>  since the call to <code>type(of:)</code> inside <code>foo</code> only sees <code>T</code> as a concrete
  type, foo will end up returning <code>P.self</code> instead of the dynamic type
  inside <code>x</code>. This can be worked around by writing <code>type(of: x as Any)</code>
  to get the dynamic type inside <code>x</code> as an <code>Any.Type</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func type&lt;Type, Metatype&gt;(of: Type) -&