[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Random questions
From: |
Daniel J Sebald |
Subject: |
Re: Random questions |
Date: |
Wed, 26 Dec 2012 13:40:00 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 12/26/2012 09:36 AM, Júlio Hoffimann wrote:
The attached diff is a microscopic change that makes the code more
intuitive.
Júlio.
// FIXME -- removing all commas does too much...
- std::string::iterator se = str.end ();
- se = std::remove (str.begin (), se, ',');
- str.erase (se, str.end ());
+ str.erase (std::remove (str.begin (), str.end(), ','), str.end ());
What is the FIXME about in this code hunk? Can the code be fixed and
the comment removed?
Also, be careful about the new expression. I can't recall any
statements about defined order of evaluation for C++ function arguments.
If the rightmost str.end() is evaluated before the leftmost str.end(),
could it be problematic? Maybe there is something about the recursive
level I don't recall, but if there is a reference that ensures order,
please indicate.
Dan
- Random questions, Júlio Hoffimann, 2012/12/19
- Random questions, John W. Eaton, 2012/12/20
- Re: Random questions, Júlio Hoffimann, 2012/12/20
- Re: Random questions, John W. Eaton, 2012/12/20
- Re: Random questions, Júlio Hoffimann, 2012/12/20
- Re: Random questions, John W. Eaton, 2012/12/20
- Re: Random questions, John W. Eaton, 2012/12/20
- Re: Random questions, Júlio Hoffimann, 2012/12/26
- Re: Random questions,
Daniel J Sebald <=
- Re: Random questions, Júlio Hoffimann, 2012/12/26
- Re: Random questions, Daniel J Sebald, 2012/12/26
- Re: Random questions, Michael Goffioul, 2012/12/20