[cfe-dev] [patch] [libc++] missing difference_type in advance implementation

Marshall Clow mclow.lists at gmail.com
Sat Mar 22 08:58:47 PDT 2014


On Mar 20, 2014, at 1:22 PM, Gonzalo BG <gonzalobg88 at gmail.com> wrote:

> On Thu, Mar 20, 2014 at 9:09 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
> Do you have a test case that failed before?
> 
> I have an iterator with a difference_type that is only explicitly convertible from int (not implicitly) and thus fails. Its implementation depends on Boost.Iterator (and everything that Boost.Iterator depends on) so I don't think it would be suitable for a test-case.

I’m also wondering about this.

The standard says that an iterator’s difference_type must be a ‘signed integer type” section 24.2.1 [iterator.requirements.general]

These types are defined in section 3.9.1 [basic.fundamental], and seems to me to imply that it has to be either one of  “signed char”, “short int”, “int”, “long int”, and “long long int”, or an “extended signed integer type” provided by the implementation (which means the compiler and/or standard library). I don’t see any provision here for an iterator having a difference_type that is a user-defined type.

Off to read the Boost.Iterator documentation….

— Marshall


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140322/cbfd27d2/attachment.html>


More information about the cfe-dev mailing list