Sort imports

This commit is contained in:
2017-10-01 19:03:42 +02:00
parent a576c36d02
commit 74b085b88d
18 changed files with 99 additions and 215 deletions

View File

@ -16,10 +16,10 @@ module tanya.container;
public import tanya.container.array;
public import tanya.container.buffer;
public import tanya.container.set;
public import tanya.container.list;
public import tanya.container.string;
public import tanya.container.queue;
public import tanya.container.set;
public import tanya.container.string;
/**
* Thrown if $(D_PSYMBOL Set) cannot insert a new element because the container

View File

@ -201,7 +201,7 @@ struct Queue(T)
{
int result;
for (size_t i = 0; !empty; ++i)
for (size_t i; !empty; ++i)
{
auto e = dequeue();
if ((result = dg(i, e)) != 0)

View File

@ -437,7 +437,7 @@ struct Set(T)
InsertStatus status = insertInUnusedBucket(value);
for (; !status; status = insertInUnusedBucket(value))
{
if ((this.primes.length - 1) == this.lengthIndex)
if (this.primes.length == (this.lengthIndex + 1))
{
throw make!HashContainerFullException(defaultAllocator,
"Set is full");

View File

@ -30,8 +30,7 @@ import core.exception;
import std.algorithm.comparison;
import std.algorithm.mutation;
import std.algorithm.searching;
import std.range : isInfinite, isInputRange, ElementEncodingType, hasLength,
popFrontN, empty;
static import std.range;
import tanya.memory;
import tanya.meta.trait;
import tanya.meta.transform;
@ -353,9 +352,9 @@ struct String
* Precondition: $(D_INLINECODE allocator is null).
*/
this(S)(const S str, shared Allocator allocator = defaultAllocator)
if (!isInfinite!S
&& isInputRange!S
&& isSomeChar!(ElementEncodingType!S))
if (!std.range.isInfinite!S
&& std.range.isInputRange!S
&& isSomeChar!(std.range.ElementEncodingType!S))
{
this(allocator);
insertBack(str);
@ -668,12 +667,12 @@ struct String
* Throws: $(D_PSYMBOL UTFException).
*/
size_t insertBack(R)(R str) @trusted
if (!isInfinite!R
&& isInputRange!R
&& is(Unqual!(ElementEncodingType!R) == char))
if (!std.range.isInfinite!R
&& std.range.isInputRange!R
&& is(Unqual!(std.range.ElementEncodingType!R) == char))
{
size_t size;
static if (hasLength!R || isNarrowString!R)
static if (std.range.hasLength!R || isNarrowString!R)
{
size = str.length + length;
reserve(size);
@ -732,11 +731,11 @@ struct String
/// ditto
size_t insertBack(R)(R str) @trusted
if (!isInfinite!R
&& isInputRange!R
&& is(Unqual!(ElementEncodingType!R) == wchar))
if (!std.range.isInfinite!R
&& std.range.isInputRange!R
&& is(Unqual!(std.range.ElementEncodingType!R) == wchar))
{
static if (hasLength!R || isNarrowString!R)
static if (std.range.hasLength!R || isNarrowString!R)
{
reserve(length + str.length * wchar.sizeof);
}
@ -771,7 +770,7 @@ struct String
}
dchar d = (range[0] - 0xd800) | ((range[1] - 0xdc00) >> 10);
range.popFrontN(2);
std.range.popFrontN(range, 2);
}
else
{
@ -798,11 +797,11 @@ struct String
/// ditto
size_t insertBack(R)(R str) @trusted
if (!isInfinite!R
&& isInputRange!R
&& is(Unqual!(ElementEncodingType!R) == dchar))
if (!std.range.isInfinite!R
&& std.range.isInputRange!R
&& is(Unqual!(std.range.ElementEncodingType!R) == dchar))
{
static if (hasLength!R || isSomeString!R)
static if (std.range.hasLength!R || isSomeString!R)
{
reserve(length + str.length * 4);
}
@ -1269,9 +1268,9 @@ struct String
* Throws: $(D_PSYMBOL UTFException).
*/
ref String opAssign(S)(S that) nothrow
if (!isInfinite!S
&& isInputRange!S
&& isSomeChar!(ElementEncodingType!S))
if (!std.range.isInfinite!S
&& std.range.isInputRange!S
&& isSomeChar!(std.range.ElementEncodingType!S))
{
this.length_ = 0;
insertBack(that);
@ -1507,7 +1506,7 @@ struct String
assert(s.length == 38);
auto byCodePoint = s.byCodePoint();
byCodePoint.popFrontN(8);
std.range.popFrontN(byCodePoint, 8);
assert(s.remove(byCodePoint).count == 0);
assert(s == "Из слова");
@ -1532,9 +1531,9 @@ struct String
* Precondition: $(D_PARAM r) refers to a region of $(D_KEYWORD this).
*/
size_t insertAfter(T, R)(R r, T el) @trusted
if ((isSomeChar!T || (!isInfinite!T
&& isInputRange!T
&& isSomeChar!(ElementEncodingType!T)))
if ((isSomeChar!T || (!std.range.isInfinite!T
&& std.range.isInputRange!T
&& isSomeChar!(std.range.ElementEncodingType!T)))
&& (is(R == ByCodeUnit!char) || is(R == ByCodePoint!char)))
in
{
@ -1565,9 +1564,9 @@ struct String
///
size_t insertBefore(T, R)(R r, T el) @trusted
if ((isSomeChar!T || (!isInfinite!T
&& isInputRange!T
&& isSomeChar!(ElementEncodingType!T)))
if ((isSomeChar!T || (!std.range.isInfinite!T
&& std.range.isInputRange!T
&& isSomeChar!(std.range.ElementEncodingType!T)))
&& (is(R == ByCodeUnit!char) || is(R == ByCodePoint!char)))
in
{