Swift: Cannot convert value of type 'UnsafeMutablePointer' to expected argument type 'UnsafeMutablePointer'
<p>I have a little Problem with my Code after updating to Swift 3. I had this Code before the conversion:</p>

<pre><code>extension NSData {
  func castToCPointer&lt;T&gt;() -&gt; T {
    let mem = UnsafeMutablePointer&lt;T&gt;.alloc(sizeof(T.Type))
    self.getBytes(mem, length: sizeof(T.Type))
    return mem.move()
  }
}
</code></pre>

<p>And I converted it to this Code and in the 3rd line I get an Error </p>

<blockquote>
  <p>... Cannot convert value of type 'UnsafeMutablePointer' to expected argument type 'UnsafeMutablePointer'</p>
</blockquote>

<pre><code>extension Data {
  func castToCPointer&lt;T&gt;() -&gt; T{
    let mem = UnsafeMutablePointer&lt;T&gt;.allocate(capacity: MemoryLayout&lt;T.Type&gt;.size)
    self.copyBytes(to: mem, count: MemoryLayout&lt;T.Type&gt;.size)
    //self.copyBytes(to: mem, count: MemoryLayout&lt;T.Type&gt;.size)
    return mem.move()
  }
}
</code></pre>

<p>Does anyone know how to get rid of this?</p>