Opened 9 years ago
Closed 8 years ago
#9929 closed Bugs (invalid)
Bugfix: comparison involving different types
Reported by: | Owned by: | Neil Groves | |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
difference_type does not necessary need to be of type int or size_t
There is a pull request with a patch in: URL_OF_BOOST_RANGE_AT_GITHUB/pull/3 (sorry but for some reason links to pull requests are rejected...)
Change History (3)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
But does it say that user-defined signed integer types are not allowed?
This is just debug code (inside a BOOST_ASSERT), and IMO the problem here is relying on implicit conversions.
Why is this debug code comparing a difference_type which is typically std::ptrdiff_t with an int? Doesn't it make sense to construct a difference_type since it is going to be compared with one anyways?
comment:3 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
But I do believe that it has to be a "signed integer type"
See [iterator.requirements.general]/p1; the last sentence:
See also [basic.fundamental]/p2, which says: