[Bug libstdc++/26020] std::advance() isn't stable for floating point numbers

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Mon Jan 30 07:54:00 GMT 2006



------- Comment #11 from gdr at integrable-solutions dot net  2006-01-30 07:54 -------
Subject: Re:  std::advance() isn't stable for floating point numbers

"Woebbeking at web dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| On Monday 30 January 2006 02:09, pcarlini at suse dot de wrote:
| > ------- Comment #9 from pcarlini at suse dot de  2006-01-30 01:09
| > ------- (In reply to comment #7)
| >
| > > reading the standard specification let me under the impression that
| > > Distance is supposed to "related" to difference_type.  For example
| > > the distance between the p before and after calling distance(p, n)
| > > is supposed to be n.  So I would suggest conversion to the
| > > difference_type of the iterator as a momentary resolution.
| >
| > Excellent idea.
| 
| FYI, I suggested tests for > 0 and < 0 as MSVC 7.1 does it that way. 
| 
| If you convert Distance to difference_type the question is what happens 
| if Distance is i.e. 0.2. Do you advance by 0 or 1 position?

does not that follow from the conversion rule?

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26020



More information about the Gcc-bugs mailing list