March 19, 2004 lvalue to slice | ||||
---|---|---|---|---|
| ||||
Provided:
int i;
How about &i implicitly converts to type int[0 .. 1] ?
You could do this:
char[] foo(char ch)
{
return "The character is: " ~ &ch; //instead of (&ch)[0 .. 1]
}
The compiler already knows how many elements it has, so why not? :)
--
Christopher E. Miller
|
Copyright © 1999-2021 by the D Language Foundation