Subject: [Boost-bugs] [Boost C++ Libraries] #10829: cardinality() of an interval_set is std::size_t independent of interval type, causing overflow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-01 09:32:41
#10829: cardinality() of an interval_set is std::size_t independent of interval
type, causing overflow
---------------------------------+---------------------
Reporter: konstantin.miller@⦠| Owner: jofaber
Type: Bugs | Status: new
Milestone: To Be Determined | Component: ICL
Version: Boost 1.49.0 | Severity: Problem
Keywords: ICL |
---------------------------------+---------------------
For an interval_set boost::icl::interval_set<int64_t>, the cardinality
function boost::icl::cardinality() returns std::size_t, which is 32-bit on
32-bit machines. This makes the result wrong, due to overflow, whenever
the cardinality of the interval_set does not fit into 32-bit.
The following code works on 64-bit but not on 32-bit:
{{{
#include <boost/icl/interval_set.hpp>
int main()
{
boost::icl::interval_set<int64_t> is;
is.add(boost::icl::interval<int64_t>::closed(1, 4294967297LL));
assert(boost::icl::cardinality(is) == 4294967297LL);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10829> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC