On 08/24/2015 06:09 PM, Adam D. Ruppe wrote:
the if(array) thread
But, this can be surprising if you aren't used to it, since an empty array is not necessarily null: [] is null passes, since the literal avoids allocating for nothing, but [1][1..$] is null fails, despite the array being empty, because the pointer is then set to the end of the input array.
void main(){
assert([1][1..$] is null);
}
You forgot to take into account constant folding.
