title: Generic in subscript for swift
body: <p>I understand that with Swift you can specify a function-specific generic with this form:</p>
  
  <pre><code>func someFunction&lt;T&gt;(type: T.Type) {...}
  </code></pre>
  
  <p>However, is it possible to do something similar with subscripts? Where you can specify a type within the brackets like so:</p>
  
  <pre><code>subscript&lt;T&gt;(type: T.Type) -&gt; T {...}
  </code></pre>
  
  <p>EDIT: Updated solution based upon the accepted answer</p>
  
  <pre><code>subscript(type: AnyClass.Type) -&gt; Any {
      return sizeof(type)
  }
  </code></pre>
  
  <p>EDIT 2: Upon testing, It seems that I cannot actually use this subscript. I get "CLASS is not identical to AnyClass.Type" so I am back to square one</p>