Fix template condition for Vector.insertBack

This commit is contained in:
Eugen Wissner 2017-01-03 10:03:28 +01:00
parent b6413823cd
commit b8d5d4c2bd
3 changed files with 21 additions and 8 deletions

View File

@ -15,8 +15,9 @@ import core.exception;
import std.algorithm.comparison; import std.algorithm.comparison;
import std.conv; import std.conv;
import std.range.primitives; import std.range.primitives;
import std.meta;
import std.traits; import std.traits;
public import tanya.enums : IL; public import tanya.meta.gen : IL;
import tanya.memory; import tanya.memory;
version (unittest) version (unittest)
@ -631,9 +632,6 @@ struct Vector(T)
return toRemove; return toRemove;
} }
/// Ditto.
alias remove = removeBack;
/// ///
unittest unittest
{ {
@ -655,7 +653,7 @@ struct Vector(T)
* Returns: The number of elements inserted. * Returns: The number of elements inserted.
*/ */
size_t insertBack(R...)(auto ref R el) @trusted size_t insertBack(R...)(auto ref R el) @trusted
if (isImplicitlyConvertible!(R[0], T)) if (allSatisfy!(ApplyRight!(isImplicitlyConvertible, T), R))
{ {
reserve(length_ + el.length); reserve(length_ + el.length);
if (capacity_ <= length_) if (capacity_ <= length_)

View File

@ -3,14 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** /**
* Generic enum templates. * Templates that generate values.
* *
* Copyright: Eugene Wissner 2016. * Copyright: Eugene Wissner 2016.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0). * Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:belka@caraus.de, Eugene Wissner) * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/ */
module tanya.enums; module tanya.meta.gen;
import std.traits; import std.traits;

View File

@ -0,0 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Metaprogramming.
*
* Copyright: Eugene Wissner 2016.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.meta;
public import tanya.meta.gen;