Tons of bugfixes (lots with closures). Added safe_recursive_delete to mem which helps easily and safely delete recursive data structures, and used it in regex. It still has a leak, but it's a lot better than before.

This commit is contained in:
Nathan Braswell
2015-06-28 14:27:48 -04:00
parent c50c977a9e
commit 48683889da
9 changed files with 80 additions and 13 deletions

View File

@@ -12,6 +12,12 @@ fun set<T>(item: T): set<T> {
return toRet
}
fun from_vector<T>(items: vector::vector<T>): set<T> {
var toRet.construct() : set<T>
items.do( fun(item: T) toRet.add(item); )
return toRet
}
obj set<T> {
var data: vector::vector<T>
fun construct() {
@@ -29,6 +35,9 @@ obj set<T> {
return false
return !data.any_true( fun(item: T): bool return !rhs.contains(item); )
}
fun operator!=(rhs: set<T>): bool {
return ! (*this == rhs)
}
fun destruct() {
data.destruct()
}