Inserts the given item into the set.
Removes the given item from the set.
import std.string : format; void testSimdSet(T)() { SimdSet!T set; assert(set.insert(1)); assert(set.length == 1); assert(set.contains(1)); assert(!set.insert(1)); set.insert(0); set.insert(20); assert(set.contains(1)); assert(set.contains(0)); assert(!set.contains(10)); assert(!set.contains(50)); assert(set.contains(20)); foreach (T i; 28 .. 127) set.insert(i); foreach (T i; 28 .. 127) assert(set.contains(i), "%d".format(i)); foreach (T i; 28 .. 127) assert(set.remove(i)); assert(set.length == 3, "%d".format(set.length)); assert(set.contains(0)); assert(set.contains(1)); assert(set.contains(20)); assert(!set.contains(28)); } testSimdSet!ubyte(); testSimdSet!ushort(); testSimdSet!uint(); testSimdSet!ulong(); testSimdSet!byte(); testSimdSet!short(); testSimdSet!int(); testSimdSet!long();
Set implementation that is well suited for small sets and simple items.
Uses SSE instructions to compare multiple elements simultaneously, but has linear time complexity. Use this container when you need to
Note: Only works on x86_64. Does NOT add GC ranges. Do not store pointers in this container unless they are also stored somewhere else.