[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c++/86015] New: Better handling of iterator distances
From:       "joshua.r.marshall.1991 at gmail dot com" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2018-05-31 15:38:38
Message-ID: bug-86015-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86015

            Bug ID: 86015
           Summary: Better handling of iterator distances
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joshua.r.marshall.1991 at gmail dot com
  Target Milestone: ---

I'm writing containers for containers to track usage and operations for
performance metrics.  I've found it impossible to allow implicit conversion
from integer types to a distance object without introducing conflicting
resolutions for all basic math operations.  It occasionally leads to errors
like the following:

/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_algo.h:2495:17:
error: no viable conversion from 'int' to
      'distance_counter<__gnu_cxx::__normal_iterator<long *, std::vector<long,
std::allocator<long> > >, long>'
      _Distance __len22 = 0;

In this instance, I think the best way to handle this is to change

stl_algo.h:2495: _Distance __len22 = 0;

to 

stl_algo.h:2495: _Distance __len22 = _Distance(0);

Am I just doing something dumb, or is this reasonable?=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic