More work on regex, fixed whitespace around && and operator= for vector

This commit is contained in:
Nathan Braswell
2015-06-14 11:13:30 -04:00
parent 36833ec263
commit 48f613a38b
12 changed files with 257 additions and 13 deletions

View File

@@ -67,6 +67,16 @@ fun delete<T(Object)>(toDelete: T*): void {
free<T>(toDelete);
}
// a wrapper for construct if it has the Object trait
fun maybe_construct<T>(it:T*):T* {
return it
}
fun maybe_construct<T(Object)>(it:T*):T* {
return it->construct()
}
// a wrapper for copy constructing if it has the Object trait
fun maybe_copy_construct<T>(to:T*, from:T*):void {
*to = *from
@@ -76,3 +86,11 @@ fun maybe_copy_construct<T(Object)>(to:T*, from:T*):void {
to->copy_construct(from)
}
// a wrapper for destruct if it has the Object trait
fun maybe_destruct<T>(it:T*):void {}
fun maybe_destruct<T(Object)>(it:T*):void {
it->destruct()
}