mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
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:
parent
05f866c066
commit
fe87dc7c42
1 changed files with 13 additions and 9 deletions
22
std/array.d
22
std/array.d
|
@ -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@@@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue