Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-234

std::distance() declaration incorrect

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2, 4.1.3
    • Fix Version/s: 4.2.0
    • Component/s: 24. Iterators
    • Labels:
      None
    • Environment:

      all

      Description

      Moved from the Rogue Wave bug tracking database:

      ***Created By: sebor @ Jul 01, 2000 02:17:12 PM***
      Subject: Wrong definition for template distance()
      Date: Sat, 1 Jul 2000 00:28:16 -0700
      From: Dennis Handly <dhandly@hpcllmx.cup.hp.com>
      To: sebor@roguewave.com
      CC: dhandly@hpcllmx.cup.hp.com, wanc@cup.hp.com

      I just noticed Perennial test Sec24/2/P24003.C is failing.
      It seems that prototype for std::distance() is incorrect:
      template <class _ForwardIterator>
      inline _TYPENAME iterator_traits<_ForwardIterator>::difference_type
      distance (const ForwardIterator &first, const _ForwardIterator &_last)

      The correct version is 24.3.4:
      template<class InputIterator>
      typename iterator_traits<InputIterator>::difference_type
      distance(InputIterator first, InputIterator last);

      Did you change this because of a compiler problem you wrote about??

      > The following is a list of problems I have encountered while porting
      > the lib to aCC 3.14.10:
      >
      > 1) JAGac61365 (aCC 3.14.10 not dropping top-level cv-qualifiers during
      > template argument deduction). This causes compilation errors in
      > std::distance<>() (many tests fail to compile).

        Attachments

          Activity

            People

            • Assignee:
              sebor Martin Sebor
              Reporter:
              sebor Martin Sebor
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: