From 4d482d31468b3091f8e56d77ca3016a4bc8f5070 Mon Sep 17 00:00:00 2001 From: monarchdodra Date: Thu, 19 Sep 2013 08:51:49 +0200 Subject: [PATCH] Fix raw write for strings --- std/format.d | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/std/format.d b/std/format.d index ac1f534aec8..732f6fb3ff4 100644 --- a/std/format.d +++ b/std/format.d @@ -2156,10 +2156,20 @@ if (isInputRange!T) } else if (f.spec == 'r') { - // raw writes - for (size_t i; !val.empty; val.popFront(), ++i) + static if (is(DynamicArrayTypeOf!T)) { - formatValue(w, val.front, f); + alias ARR = DynamicArrayTypeOf!T; + foreach (e ; cast(ARR)val) + { + formatValue(w, e, f); + } + } + else + { + for (size_t i; !val.empty; val.popFront(), ++i) + { + formatValue(w, val.front, f); + } } } else if (f.spec == '(')