I want to implement function in Swift similar to default `find`, but which accept comparator:

```
func find<C : CollectionType>(domain: C, comparator: (C.Generator.Element) -> Bool) -> C.Index? {
    for (index, element) in enumerate(domain) {
        if comparator(element) {
            return index
        }
    }

    return nil
}

```

The problem that `enumerate` returns tuple of type `(Int, C.Generator.Element)`, while i need `(C.Index, C.Generator.Element)`. I have searched much, but didn't find how to iterate using `C.Index` type.

**Edit.**

Sorry, it was a typo. I mean `enumerate` instead of `generate`