Can't finish template inst tonight.

This commit is contained in:
Nathan Braswell
2018-10-08 00:28:42 -04:00
parent 0ae2fbaae6
commit 39ecf24e69
8 changed files with 575 additions and 448 deletions

View File

@@ -1,6 +1,7 @@
import vec
import io
import serialize
import util
fun set<T>(): set<T> {
var toRet.construct() : set<T>
@@ -55,6 +56,11 @@ obj set<T> (Object, Serializable) {
fun size():int {
return data.size
}
fun single(): T {
if (size() != 1)k
util::error("trying to single with size != 1")
return data[0]
}
fun contains(items: ref set<T>): bool {
return items.size() == 0 || !items.any_true( fun(item: T): bool return !contains(item); )
}