-fully working betterC for windows

*replaced array[..] = array[ .. ] sclice copy with mempcy
 *added own std library (allocator, alloca, Mutex)
 *changed tamplates for collecting components for systems
-fixed issue with multiple optional components registering for system
This commit is contained in:
Mergul 2019-10-10 20:56:44 +02:00
parent ed99807871
commit 41f1c6474b
14 changed files with 722 additions and 868 deletions

View file

@ -3,7 +3,7 @@ module ecs.vector;
import core.bitop;
import core.stdc.stdlib : free, malloc;
import core.stdc.string : memcpy, memset;
import std.algorithm : swap;
//import std.algorithm : swap;
import std.conv : emplace;
import std.traits : hasMember, isCopyable, TemplateOf, Unqual;
@ -28,7 +28,7 @@ public:
}
static if (isCopyable!T) {
/*static if (isCopyable!T) {
export this(this) {
T[] tmp = array[0 .. used];
array = null;
@ -37,7 +37,9 @@ public:
}
} else {
@disable this(this);
}
}*/
@disable this(this);
export ~this() {
clear();
@ -167,7 +169,8 @@ public:
export void remove(size_t elemNum) {
destroy(array[elemNum]);
swap(array[elemNum], array[used - 1]);
//swap(array[elemNum], array[used - 1]);
array[elemNum] = array[used - 1];
used--;
}