From b8d5d4c2bd1e8b9637782b36b8ccbafd2785070e Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 3 Jan 2017 10:03:28 +0100 Subject: [PATCH] Fix template condition for Vector.insertBack --- source/tanya/container/vector.d | 8 +++----- source/tanya/{enums.d => meta/gen.d} | 6 +++--- source/tanya/meta/package.d | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) rename source/tanya/{enums.d => meta/gen.d} (90%) create mode 100644 source/tanya/meta/package.d diff --git a/source/tanya/container/vector.d b/source/tanya/container/vector.d index ac26d43..0e67b54 100644 --- a/source/tanya/container/vector.d +++ b/source/tanya/container/vector.d @@ -15,8 +15,9 @@ import core.exception; import std.algorithm.comparison; import std.conv; import std.range.primitives; +import std.meta; import std.traits; -public import tanya.enums : IL; +public import tanya.meta.gen : IL; import tanya.memory; version (unittest) @@ -631,9 +632,6 @@ struct Vector(T) return toRemove; } - /// Ditto. - alias remove = removeBack; - /// unittest { @@ -655,7 +653,7 @@ struct Vector(T) * Returns: The number of elements inserted. */ size_t insertBack(R...)(auto ref R el) @trusted - if (isImplicitlyConvertible!(R[0], T)) + if (allSatisfy!(ApplyRight!(isImplicitlyConvertible, T), R)) { reserve(length_ + el.length); if (capacity_ <= length_) diff --git a/source/tanya/enums.d b/source/tanya/meta/gen.d similarity index 90% rename from source/tanya/enums.d rename to source/tanya/meta/gen.d index 8fdbf8d..a87a90b 100644 --- a/source/tanya/enums.d +++ b/source/tanya/meta/gen.d @@ -3,14 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** - * Generic enum templates. + * Templates that generate values. * * Copyright: Eugene Wissner 2016. * License: $(LINK2 https://www.mozilla.org/en-US/MPL/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; diff --git a/source/tanya/meta/package.d b/source/tanya/meta/package.d new file mode 100644 index 0000000..c511220 --- /dev/null +++ b/source/tanya/meta/package.d @@ -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;