Unable to use indices.contains() in a Collection extension in Swift 3
<p>I wrote following extension in Swift 2.3:</p>

<pre><code>extension CollectionType {
    /// Returns the element at the specified index iff it is within bounds, otherwise nil.
    subscript (safe index: Index) -&gt; Generator.Element? {
        return indices.contains(index) ? self[index] : nil
    }
}
</code></pre>

<p>However, it turns out that Swift 3.0 does not have <code>contains()</code> function. Instead, it offers me following syntax for this method:</p>

<pre><code>indices.contains(where: { (&lt;#Self.Indices.Iterator.Element#&gt;) -&gt; Bool in
    &lt;# code ??? what should it do??? #&gt;
})
</code></pre>

<p>The problem is that I don't know what should it contain inside the block. Any help with migrating it, please?</p>