Boost C++ Libraries: Ticket #11803: Fails with closed intervals fails in some border cases. https://svn.boost.org/trac10/ticket/11803 <p> ICL seems not to handle sets that contain the maximum element of the domain type. I have attached a file that shows the problem. </p> <p> The problem is in the fie \boost\icl\concept\interval.hpp (line 1145) in the left_subtract. </p> <p> It should look like this: </p> <pre class="wiki">template&lt;class Type&gt; typename boost::enable_if&lt;is_static_closed&lt;Type&gt;, Type&gt;::type left_subtract(Type right, const Type&amp; left_minuend) { if(exclusive_less(left_minuend, right)) return right; else if(upper_less_equal(right, left_minuend)) return identity_element&lt;Type&gt;::value(); return construct&lt;Type&gt;(domain_next&lt;Type&gt;(upper(left_minuend)), upper(right)); } </pre><p> Where as it actually looks like this: </p> <pre class="wiki">template&lt;class Type&gt; typename boost::enable_if&lt;is_static_closed&lt;Type&gt;, Type&gt;::type left_subtract(Type right, const Type&amp; left_minuend) { if(exclusive_less(left_minuend, right)) return right; return construct&lt;Type&gt;(domain_next&lt;Type&gt;(upper(left_minuend)), upper(right)); } </pre><p> The right subtract function is ok. </p> <p> The comment for the left_subtract functions is also wrong. "Return the difference: The part of \c right <strong>right</strong> of \c left_minuend." </p> <p> The word "right" in BOLD should read "left". </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11803 Trac 1.4.3 shewitt.au@… Wed, 18 Nov 2015 17:03:35 GMT attachment set https://svn.boost.org/trac10/ticket/11803 https://svn.boost.org/trac10/ticket/11803 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">icl_question.cpp</span> </li> </ul> Ticket shewitt.au@… Wed, 18 Nov 2015 17:11:36 GMT <link>https://svn.boost.org/trac10/ticket/11803#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11803#comment:1</guid> <description> <p> Here's the output of the sample program: </p> <pre class="wiki">BAD: {[0,9fff][a000,ffff]} GOOD: {[0,9fff][a000,bfff][c000,fffe]} </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 18 Nov 2015 22:49:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11803#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11803#comment:2</guid> <description> <p> <strong>Correction:</strong> The comment for <em>left_subtract</em> is correct and should read as is ("The part of \c right <strong>right</strong> of \c left_minuend."). It's the comment for <em>right_subtract</em> that's wrong. It reads "Return the difference: The part of \c left <strong>right</strong> of \c right_minuend." the word in <strong>bold</strong>should read "left". </p> <p> Clarification: The extra check I added is already present in <em>right_subtract</em> so efficiency arguments seem not to apply. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 19 Nov 2015 00:22:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11803#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11803#comment:3</guid> <description> <p> It's been mention in mailing list that "You can use icl interval containers with limited integral numeric domain-types safely on intervals using values from ++std::min&lt;T&gt;() to--std::max&lt;T&gt;()". </p> <p> If this is the case then even code such as this is illegal: </p> <pre class="wiki">boost::interval_set&lt;unsigned int&gt; int(0, 10); </pre><p> This seems unacceptable. And as mentioned above the code in <em>right_subtract</em> already guards against this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joachim Faulhaber</dc:creator> <pubDate>Thu, 19 Nov 2015 08:56:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11803#comment:4 https://svn.boost.org/trac10/ticket/11803#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket shewitt.au@… Thu, 19 Nov 2015 12:18:22 GMT <link>https://svn.boost.org/trac10/ticket/11803#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11803#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11803#comment:4" title="Comment 4">jofaber</a>: I'm new to the boost svn repo and such, but I can't see any changes. The obvious question is does "Resolution set to fixed" mean changes were made to fix this issue, or, that no changes were made because this it is not considered a problem? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joachim Faulhaber</dc:creator> <pubDate>Thu, 19 Nov 2015 12:51:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11803#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11803#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11803#comment:5" title="Comment 5">shewitt.au@…</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11803#comment:4" title="Comment 4">jofaber</a>: I'm new to the boost svn repo and such, but I can't see any changes. The obvious question is does "Resolution set to fixed" mean changes were made to fix this issue, or, that no changes were made because this it is not considered a problem? </p> </blockquote> <p> The changes were made to the develop branch on modular-boost <a class="ext-link" href="https://github.com/boostorg/icl/blob/develop/include/boost/icl/concept/interval.hpp"><span class="icon">​</span>https://github.com/boostorg/icl/blob/develop/include/boost/icl/concept/interval.hpp</a> </p> <p> From there it will be merged to master after regression tests are being checked. </p> </description> <category>Ticket</category> </item> </channel> </rss>