Improved documentation and removed some old code

This commit is contained in:
Mergul 2020-05-06 10:55:40 +02:00
parent 5411e97cb1
commit 46aba822d0
3 changed files with 21 additions and 40 deletions

View file

@ -4,11 +4,16 @@ import bubel.ecs.std;
//import core.stdc.string;
/************************************************************************************************************************
Vector for byte data. Simpler than standard template-based implementation designed for better performance. \
Rellocates 1024 elements at once instead of doubling size.
*/
struct SimpleVector
{
@disable this(this);
///Add element to vector
void add(ubyte el) nothrow @nogc
{
while(used >= data.length)
@ -19,6 +24,7 @@ struct SimpleVector
data[used++] = el;
}
///Add array of elements to vector
void add(ubyte[] el) nothrow @nogc
{
while(used + el.length >= data.length)
@ -30,6 +36,7 @@ struct SimpleVector
used += el.length;
}
///Return vector length
size_t length() nothrow @nogc
{
return used;
@ -55,6 +62,7 @@ struct SimpleVector
return used;
}
///set vector length to 0
void clear() nothrow @nogc
{
used = 0;