I have a function that reads a line of string and do some computation.

I searched the forum and found that people use `const(char)[]` or `in char[]` to accept both string and char[] arguments.


What's the difference between `const(char)[]` and `in char[]`?

If they are not the same, then which is better? If they are, then why both forms exists?

I found it a bit confusing and not quite readable, so I made an alias:

alias str = const(char)[]

and so far it works. But if `in char[]` is better, then I cannot alias it:

alias str = in char[]

this does not compile.

Reply via email to