String literal reduces memory allocation.

`-profile=gc` showed that `assert` allocated memory for every iteration.
This commit is contained in:
drug007 2018-09-20 10:32:25 +03:00 committed by GitHub
parent f963694522
commit 2d3df68333
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -941,7 +941,8 @@ private static auto implementOp(OpKind kind, string name, T, ARGS...)(ref T self
//import std.meta : staticMap; pragma(msg, staticMap!(isMatchingUniqueType!(T.Union), info.ReturnTypes));
switch (self.m_kind) {
default: assert(false, "Operator "~name~" ("~kind.stringof~") can only be used on values of the following types: "~[info.fields].join(", "));
enum assert_msg = "Operator "~name~" ("~kind.stringof~") can only be used on values of the following types: "~[info.fields].join(", ");
default: assert(false, assert_msg);
foreach (i, f; info.fields) {
alias FT = typeof(__traits(getMember, T.Union, f));
case __traits(getMember, T.Kind, f):