@@ -1074,6 +1074,7 @@ $(H3 $(LNAME2 cast_array, Arrays))
1074
1074
as a type paint, with the array length adjusted to match any change in
1075
1075
element size. If there's not a match, a runtime error is generated.)
1076
1076
1077
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1077
1078
---
1078
1079
import std.stdio;
1079
1080
@@ -1090,7 +1091,9 @@ $(H3 $(LNAME2 cast_array, Arrays))
1090
1091
return 0;
1091
1092
}
1092
1093
---
1094
+ )
1093
1095
1096
+ $(DDOC_SEE_ALSO $(RELATIVE_LINK2 cast_array_literal, Casting array literals).)
1094
1097
1095
1098
$(H3 $(LNAME2 cast_static_array, Static Arrays))
1096
1099
@@ -1618,11 +1621,14 @@ $(GNAME ArrayLiteral):
1618
1621
}
1619
1622
---
1620
1623
1624
+ $(H3 $(LNAME2 cast_array_literal, Casting))
1625
+
1621
1626
$(P When array literals are cast to another array type, each
1622
1627
element of the array is cast to the new element type.
1623
- When arrays that are not literals are cast, the array is
1628
+ When arrays that are not literals $(RELATIVE_LINK2 cast_array, are cast) , the array is
1624
1629
reinterpreted as the new type, and the length is recomputed:)
1625
1630
1631
+ $(SPEC_RUNNABLE_EXAMPLE_RUN
1626
1632
---
1627
1633
import std.stdio;
1628
1634
@@ -1641,6 +1647,7 @@ $(GNAME ArrayLiteral):
1641
1647
writeln(rt); // writes [257]
1642
1648
}
1643
1649
---
1650
+ )
1644
1651
1645
1652
In other words, casting literal expression will change the literal type.
1646
1653
0 commit comments