Thank you again, Jonathan. So "have no length property" means std.range.hasLength = false. Now I understand.

On Sun, 21 Aug 2011 03:51:05 +0400, Jonathan M Davis <[email protected]> wrote:

On Saturday, August 20, 2011 13:11:44 unDEFER wrote:
Big thanks, Jonathan!
You give me very clearly explanations.
But what you mean by "strings of char and wchar ... have no length
property" if "string.length" really works? Is it a bug?

All arrays have a length property. It returns the number of elements in the array. The issue is std.range.hasLength, which is what is used with range- based functions in template constraints and static ifs. hasLength is true for all arrays _except_ for arrays of char and wchar. This is because strings are ranges of dchar - of code points - whereas they are arrays of code units, and in UTF-8 and UTF-16, there can be more than one code unit per code point. In the general case, calling length on an array of char or wchar isn't going to give you the the number of code points in the array. So, it's normally
incorrect to use length with arrays of char and wchar in range-based
functions.

- Jonathan M Davis
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos


--
Nikolay Krivchenkov aka unDEFER
I want to believe... in unDE.su
registered Linux user #360474
Don't worry, I can read OpenOffice.org/Libre Office/Lotus Symphony documents
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to