Re: [utility] question on prior(x,n)

From: Daniel Frey [mailto:daniel.frey@aixigo.de]
Should we propose std::regress (the counter-part for std::advance) for standardization (via a DR)? The current definition of std::advance seems to limit the number of elements that can be skipped backwards to signed types, but the container can be larger (OK, in theory, never tried it myself :). This would also nicely solve the implementation issue for us.
I don't think it's really a defect; there's a slight inconsistency with regards to the max/min values on most platforms, but nothing inherently wrong AFAICS. Note that the reverse_iterator trick can be used by client code too, so the "signed type limit" is easily defeated. [snip]
right? Although I wonder what happens if T is already a reverse iterator. Is it legal to reverse a reverse_iterator? Or do we need a trait and implement both cases separately?
Yes, reversing a reverse_iterator this way is fine (because a reverse_iterator satisfies the iterator requirements). Bjorn

Bjorn.Karlsson@readsoft.com wrote:
From: Daniel Frey [mailto:daniel.frey@aixigo.de]
Should we propose std::regress (the counter-part for std::advance) for standardization (via a DR)? The current definition of std::advance seems to limit the number of elements that can be skipped backwards to signed types, but the container can be larger (OK, in theory, never tried it myself :). This would also nicely solve the implementation issue for us.
I don't think it's really a defect; there's a slight inconsistency with regards to the max/min values on most platforms, but nothing inherently wrong AFAICS. Note that the reverse_iterator trick can be used by client code too, so the "signed type limit" is easily defeated.
The reason to call it a DR is, that it can be handled faster and easier than a real extension. :) I just don't know if this is acceptable. What to the standard guys around here say? Worth a try? Regards, Daniel -- Daniel Frey aixigo AG - financial solutions & technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey@aixigo.de, web: http://www.aixigo.de

Daniel Frey <daniel.frey@aixigo.de> writes: | The reason to call it a DR is, that it can be handled faster and | easier than a real extension. :) I just don't know if this is That is called "bending the rules". It is not advisable. my 2 cents, -- Gaby

At 08:48 AM 2/23/2004, Daniel Frey wrote:
Bjorn.Karlsson@readsoft.com wrote:
From: Daniel Frey [mailto:daniel.frey@aixigo.de]
Should we propose std::regress (the counter-part for std::advance) for standardization (via a DR)? The current definition of std::advance seems to limit the number of elements that can be skipped backwards to signed types, but the container can be larger (OK, in theory, never tried it myself :). This would also nicely solve the implementation issue for us.
I don't think it's really a defect; there's a slight inconsistency with regards to the max/min values on most platforms, but nothing inherently wrong AFAICS. Note that the reverse_iterator trick can be used by client code too, so the "signed type limit" is easily defeated.
The reason to call it a DR is, that it can be handled faster and easier than a real extension. :) I just don't know if this is acceptable. What to the standard guys around here say? Worth a try?
No, it isn't a DR. OTOH, the LWG is now accepting issues for C++0x which propose extensions and changes which aren't DR's. There isn't any formal definition of what is small enough to be treated as an issue rather than requiring a full-fledged formal proposal paper. If it can be expressed clearly in a page or less, including the proposed wording change to the standard, then I'd be willing to submit it as an issue. Without explicit standardese proposed wording, the chance of acceptance is much reduced. The committee has no staff sitting around waiting to write standardese for bright ideas. --Beman

Beman Dawes wrote:
At 08:48 AM 2/23/2004, Daniel Frey wrote:
The reason to call it a DR is, that it can be handled faster and easier than a real extension. :) I just don't know if this is acceptable. What to the standard guys around here say? Worth a try?
No, it isn't a DR.
OTOH, the LWG is now accepting issues for C++0x which propose extensions and changes which aren't DR's.
There isn't any formal definition of what is small enough to be treated as an issue rather than requiring a full-fledged formal proposal paper. If it can be expressed clearly in a page or less, including the proposed wording change to the standard, then I'd be willing to submit it as an issue. Without explicit standardese proposed wording, the chance of acceptance is much reduced. The committee has no staff sitting around waiting to write standardese for bright ideas.
Thanks for explaining it. I'll try to prepare a small document and send it to you directly. One last question for the group: Is the name std::regress OK or are there any objections / better ideas? Regards, Daniel -- Daniel Frey aixigo AG - financial solutions & technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey@aixigo.de, web: http://www.aixigo.de
participants (4)
-
Beman Dawes
-
Bjorn.Karlsson@readsoft.com
-
Daniel Frey
-
Gabriel Dos Reis