[Issue 11808] std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 23 12:55:51 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11808


Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh at gmail.com


--- Comment #1 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-12-23 12:55:48 PST ---
(In reply to comment #0)
> import std.uni;
> 
> auto set1 = CodepointSet('А', 'Я'+1, 'а', 'я'+1);


>     {
>         assert(intervals.length % 2 == 0, "Odd number of interval bounds [a,
> b)!");
>         for(uint i=1; i<intervals.length; i++)
> 
> 
>             assert(intervals[i-1] < intervals[i]);
> //_______________________________!!!

Indeed the assumption is that intervals are strictly disjoint and sorted.
I'm not sure if it's documented exactly like that but it should be.

If it's not known in advance then creating a set per interval and using
operator | would work. 
I'm not sure how much to tweak this constructor, e.g. allow partially
overlapped intervals? Allow unordered intervals?

auto set2 = CodepointSet('а', 'я'+1, 'А', 'Я'+5);

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list