Make containers work with non-copyable elements

It is the first step. The containers can be at least created with
non-copyable structs without compilation errors now.
Fix #69.
This commit is contained in:
2018-11-24 06:25:55 +01:00
parent 884dc30953
commit 49d7452b33
8 changed files with 215 additions and 89 deletions

View File

@ -16,6 +16,7 @@ module tanya.hash.lookup;
import tanya.meta.trait;
import tanya.range.primitive;
version (unittest) import tanya.test.stub;
private struct FNV
{
@ -146,14 +147,6 @@ version (unittest)
~ r10!x ~ r10!x ~ r10!x ~ r10!x ~ r10!x;
enum string r500(string x) = r100!x ~ r100!x ~ r100!x ~ r100!x ~ r100!x;
private static struct ToHash
{
size_t toHash() const @nogc nothrow pure @safe
{
return 0;
}
}
private static struct HashRange
{
string fo = "fo";
@ -178,9 +171,9 @@ version (unittest)
{
bool empty_;
@property ToHash front() const @nogc nothrow pure @safe
@property Hashable front() const @nogc nothrow pure @safe
{
return ToHash();
return Hashable();
}
void popFront() @nogc nothrow pure @safe
@ -199,7 +192,7 @@ version (unittest)
@nogc nothrow pure @safe unittest
{
assert(hash(null) == 0);
assert(hash(ToHash()) == 0U);
assert(hash(Hashable()) == 0U);
assert(hash('a') == 'a');
}