Re: <map> erase
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Thu, 6 Oct 2005 13:21:49 -0400
aa <ss> wrote:
> "Stephen Howe" <sjhoweATdialDOTpipexDOTcom> wrote in message
> news:%23YpNagVyFHA.664@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hmm, wait, I don't understand how that is proper. In ++x, the
>>> iterator is incremented before being passed to erase. In x++, the
>>> iterator is incremented after being passed to erase...
>>
>> The increments are not supposed to occur after the function call.
>
> Is this documented somewhere?
C++ standard:
1.9/7 Accessing an object designated by a volatile lvalue (3.10),
modifying an object, calling a library I/O function, or calling a
function that does any of those operations are all side effects, which
are changes in the state of the execution environment. Evaluation of an
expression might produce side effects. At certain specified points in
the execution sequence called sequence points, all side effects of
previous evaluations shall be complete and no side effects of subsequent
evaluations shall have taken place.
1.9/17 When calling a function (whether or not the function is inline),
there is a sequence point after the evaluation of all function arguments
(if any) which takes place before execution of any expressions or
statements in the function body.
5.2.6/1 The value obtained by applying a postfix ++ is the value that
the operand had before applying the operator. [Note: the value obtained
is a copy of the original value ] The operand shall be a modifiable
lvalue. The type of the operand shall be an arithmetic type or a pointer
to a complete object type. After the result is noted, the value of the
object is modified by adding 1 to it, unless the object is of type bool,
in which case it is set to true. [Note: this use is deprecated, see
annex D. ] The result is an rvalue. The type of the result is the
cv-unqualified version of the type of the operand.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- <map> erase
- From: Ian Semmel
- Re: <map> erase
- From: Stephen Howe
- Re: <map> erase
- From: Jason Winnebeck
- Re: <map> erase
- From: Stephen Howe
- Re: <map> erase
- From: aa
- <map> erase
- Prev by Date: Re: <map> erase
- Next by Date: Re: STL strike again: The revenge of the set
- Previous by thread: Re: <map> erase
- Next by thread: Re: STL strike again: The revenge of the set
- Index(es):
Relevant Pages
|