Fixed quite a few bugs, including makeing find template functions check for trait subset, not trait equality, and add the number required to the satisfied count. Based on what is now breaking, it looks like it's time to give the builtin functions types.

This commit is contained in:
Nathan Braswell
2014-07-23 02:23:21 -07:00
parent eae538907d
commit 87ad0c187e
7 changed files with 182 additions and 131 deletions

View File

@@ -56,7 +56,7 @@ template <T> void delete(T* toDelete, int itemCount) {
}
template <T(Destructable)> void delete(T* toDelete, int itemCount) {
for (int i = 0; i < itemDestructCount; i++;)
for (int i = 0; i < itemCount; i++;)
toDelete[i].destruct();
delete<T>(toDelete);
}
@@ -67,7 +67,6 @@ template <T> void delete(T* toDelete) {
}
template <T(Destructable)> void delete(T* toDelete) {
if (destruct)
toDelete->destruct();
toDelete->destruct();
free(toDelete);
}

View File

@@ -1,13 +1,13 @@
import mem;
import util;
typedef template<T> vector {
typedef template<T> vector (Destructable) {
T *data;
int size;
int available;
bool destroyItems;
vector<T> *construct(bool destroyItemsIn) {
vector<T>* construct(bool destroyItemsIn) {
destroyItems = destroyItemsIn;
return construct();
size = 0;