Template instantiation and string vs const char[]

2014-09-02 Thread Jason den Dulk via Digitalmars-d-learn
I have this piece of code: template somet(R...) { static if (R.length) { string somet = "[\n"~R[0]~"\n" ~ somet!(R[1..R.length]) ~ "]\n"; } else string somet = ""; } void main() { writeln(somet!("name","tame")); writeln(somet!"name"); } When I compile it, it generates th

Re: Template instantiation and string vs const char[]

2014-09-03 Thread JR via Digitalmars-d-learn
On Wednesday, 3 September 2014 at 05:18:42 UTC, Jason den Dulk wrote: [...] While not really answering your question, I believe the idiomatic way is to use enum here instead of string/char[]. Conjecture: strings are final but the symbol can be redirected to point to new arrays, such as resul