diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-02-01 06:33:41 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-02-01 06:33:41 +0100 |
| commit | 7af5c3082094c5507a48f5957ef680d8448fbfc3 (patch) | |
| tree | a4a378ff8e605e9073b6fd53511e735e63d303b0 | |
| parent | c1535e87529b4a0ae174832d211880e69c9d97dc (diff) | |
| download | tanya-7af5c3082094c5507a48f5957ef680d8448fbfc3.tar.gz | |
move(): Give compiler an opportunity to optimizev0.15.0
Fix #75.
| -rw-r--r-- | source/tanya/algorithm/mutation.d | 15 | ||||
| -rw-r--r-- | source/tanya/typecons.d | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/source/tanya/algorithm/mutation.d b/source/tanya/algorithm/mutation.d index bd71f40..99b0eae 100644 --- a/source/tanya/algorithm/mutation.d +++ b/source/tanya/algorithm/mutation.d @@ -5,7 +5,7 @@ /** * Algorithms that modify its arguments. * - * Copyright: Eugene Wissner 2017-2018. + * Copyright: Eugene Wissner 2017-2019. * 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) @@ -223,9 +223,16 @@ void move(T)(ref T source, ref T target) /// ditto T move(T)(ref T source) @trusted { - T target = void; - moveEmplace(source, target); - return target; + static if (hasElaborateCopyConstructor!T || hasElaborateDestructor!T) + { + T target = void; + moveEmplace(source, target); + return target; + } + else + { + return source; + } } /// diff --git a/source/tanya/typecons.d b/source/tanya/typecons.d index 516a34d..1407c62 100644 --- a/source/tanya/typecons.d +++ b/source/tanya/typecons.d @@ -660,7 +660,7 @@ if (isTypeTuple!Specs && NoDuplicates!Specs.length == Specs.length) } /** - * Tells whether this $(D_PSYMBOL Variant) was initialized. + * Tells whether this $(D_PSYMBOL Variant) is initialized. * * Returns: $(D_KEYWORD true) if this $(D_PSYMBOL Variant) contains a * value, $(D_KEYWORD false) otherwise. @@ -765,7 +765,7 @@ if (isTypeTuple!Specs && NoDuplicates!Specs.length == Specs.length) /** * Returns $(D_PSYMBOL TypeInfo) corresponding to the current type. * - * If this $(D_PSYMBOL Variant) isn't initialized, return + * If this $(D_PSYMBOL Variant) isn't initialized, returns * $(D_KEYWORD null). * * Returns: $(D_PSYMBOL TypeInfo) of the current type. |
