Fix Issue 20186 - File size of "Hello, world" executable increased by 185KB

We can delay the std.format import until the relevant templates are
instantiated.
This commit is contained in:
Vladimir Panteleev 2019-09-01 03:21:26 +00:00
parent 05f866c066
commit fe87dc7c42
No known key found for this signature in database
GPG key ID: 5004F0FAD051576D

View file

@ -3216,7 +3216,6 @@ struct Appender(A)
if (isDynamicArray!A)
{
import core.memory : GC;
import std.format : FormatSpec;
private alias T = ElementEncodingType!A;
@ -3559,7 +3558,7 @@ if (isDynamicArray!A)
* Returns:
* A `string` if `writer` is not set; `void` otherwise.
*/
string toString() const
string toString()() const
{
import std.format : singleSpec;
@ -3582,15 +3581,20 @@ if (isDynamicArray!A)
}
/// ditto
void toString(Writer)(ref Writer w, scope const ref FormatSpec!char fmt) const
template toString(Writer)
if (isOutputRange!(Writer, char))
{
import std.format : formatValue;
import std.range.primitives : put;
put(w, Unqual!(typeof(this)).stringof);
put(w, '(');
formatValue(w, data, fmt);
put(w, ')');
import std.format : FormatSpec;
void toString(ref Writer w, scope const ref std.format.FormatSpec!char fmt) const
{
import std.format : formatValue;
import std.range.primitives : put;
put(w, Unqual!(typeof(this)).stringof);
put(w, '(');
formatValue(w, data, fmt);
put(w, ')');
}
}
// @@@DEPRECATED_2.089@@@