mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +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)
|
if (isDynamicArray!A)
|
||||||
{
|
{
|
||||||
import core.memory : GC;
|
import core.memory : GC;
|
||||||
import std.format : FormatSpec;
|
|
||||||
|
|
||||||
private alias T = ElementEncodingType!A;
|
private alias T = ElementEncodingType!A;
|
||||||
|
|
||||||
|
@ -3559,7 +3558,7 @@ if (isDynamicArray!A)
|
||||||
* Returns:
|
* Returns:
|
||||||
* A `string` if `writer` is not set; `void` otherwise.
|
* A `string` if `writer` is not set; `void` otherwise.
|
||||||
*/
|
*/
|
||||||
string toString() const
|
string toString()() const
|
||||||
{
|
{
|
||||||
import std.format : singleSpec;
|
import std.format : singleSpec;
|
||||||
|
|
||||||
|
@ -3582,15 +3581,20 @@ if (isDynamicArray!A)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
void toString(Writer)(ref Writer w, scope const ref FormatSpec!char fmt) const
|
template toString(Writer)
|
||||||
if (isOutputRange!(Writer, char))
|
if (isOutputRange!(Writer, char))
|
||||||
{
|
{
|
||||||
import std.format : formatValue;
|
import std.format : FormatSpec;
|
||||||
import std.range.primitives : put;
|
|
||||||
put(w, Unqual!(typeof(this)).stringof);
|
void toString(ref Writer w, scope const ref std.format.FormatSpec!char fmt) const
|
||||||
put(w, '(');
|
{
|
||||||
formatValue(w, data, fmt);
|
import std.format : formatValue;
|
||||||
put(w, ')');
|
import std.range.primitives : put;
|
||||||
|
put(w, Unqual!(typeof(this)).stringof);
|
||||||
|
put(w, '(');
|
||||||
|
formatValue(w, data, fmt);
|
||||||
|
put(w, ')');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @@@DEPRECATED_2.089@@@
|
// @@@DEPRECATED_2.089@@@
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue