Skip to content

Instantly share code, notes, and snippets.

@seivan
Last active June 11, 2016 16:59
Show Gist options
  • Save seivan/3819651417cd0bb6edb24ff2fd547c61 to your computer and use it in GitHub Desktop.
Save seivan/3819651417cd0bb6edb24ff2fd547c61 to your computer and use it in GitHub Desktop.
try this
struct ExpressionErased : Chainable {
var chainType: SQLiteChainType = .None
let __andOperator:((rhs:Chainable) -> [Chainable])
init<T : Chainable>(expression:T) {
self.__andOperator = expression.andOperator
}
func andOperator(rhs: Chainable) -> [Chainable] {
return self.__andOperator(rhs: rhs)
}
}
//Usage
let oneWithIntErased = ExpressionErased(expression: oneWithInt)
let oneWithDoubleErased = ExpressionErased(expression: oneWithDouble)
let myBagOfGoodies = [oneWithIntErased, oneWithDoubleErased]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment