Strings concatenated at compile time?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 1 04:12:41 PDT 2014
On Thursday, 1 May 2014 at 10:42:36 UTC, Unwise wrote:
> In the following example from the documentation, are strings
> concatenated at compile time?
>
> template foo(string s) {
> string bar() { return s ~ " betty"; }
> }
>
> void main() {
> writefln("%s", foo!("hello").bar()); // prints: hello betty
> }
I guess it's not guaranteed, but constant folding should take
care of it, yes.
More information about the Digitalmars-d-learn
mailing list