title: swift how to compare generics
body: <p>I have a protocol called <code>SomeProtocol</code></p>
  
  <p>I want to create a function that get an object that confirms to this protocol, and add it to an array.</p>
  
  <p>then I have another function that remove an object from this array.  </p>
  
  <pre><code>var allObjs = [SomeProtocol]()
  
  func addObj&lt;T: AnyObject where T: SomeProtocol&gt;(obj: T) {
      allObjs.append(obj)
  }
  
  func removeObj&lt;T: AnyObject where T: SomeProtocol&gt;(obj: T) {
      for someObj in allObjs {
          if someObj == obj { // compile time error -&gt; Binary operator '==' cannot be applied to operands of type 'SomeProtocol' and 'T'
  
          }
      }
  }  
  </code></pre>
  
  <p>This code will cause a compile time error "Binary operator '==' cannot be applied to operands of type 'SomeProtocol' and 'T'"  </p>
  
  <p>not sure how can i fix that, both object where defined as AnyObject who confirm to the SomeProtocol protocol, so what is the problem here?</p>