[libstdc++] Doxygen markup for algorithms
Jonathan Wakely
cow@compsoc.man.ac.uk
Mon Feb 11 02:35:00 GMT 2002
On Sun, Feb 10, 2002 at 08:44:13PM -0800, Kenny Simpson wrote:
> I believe the description for std::for_each is overly
> restrictive. In particular, the requirement that
> * @p f must not modify its argument.
>
> Not the the old draft Standard had this restriction,
> but the final version does not. (implied from issue
> 290 - don't have my copy of the Standard in front of
> me).
>
> See
> http://std.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#290
>
> And also see Section 9.2.2: Nonmodifying Algorithms
> and Modifying Algorithms in Josutis' Book where he
> states that the function object passed to for_each may
> modify the element.
Oops, my mistake, I should have spotted that. I was working mainly from
the SGI docs when I started, and should have gone back to review it with
the other sources I was using (Josutis isn't one of them unfortunately)
Reading the text of the proposal am I right in thinking it can modify the
argument so long as it doesn't change anything that would affect the
ordering of the sequence?
To be honest, I'm glad the function object can modify its arg, as I've
got code that uses a functor to delete each pointer in a sequence, so now
I know it's standard conforming :)
Should there be a doxygen group for "non-modifying sequence operations"
that describes the common features of for_each, find_if etc. ?
I'll read the lwg issues again and review all my doxygen comments asap.
Thanks for spotting it!
jon
--
Dull but sincere filler
More information about the Libstdc++
mailing list