• Greg (unregistered)

    Looks like they're allergic to references... That first loop would be a lot more efficient written as for(string const & name : invec) Thinking on it, maybe they don't know about references at all and that's the reason for the pointer in the map? That actually allows changing the value of the string pointed to, even if you're looping using copies of the vector content...

  • Artistic Reference (unregistered)

    Well Remi, you ARE right,

    But where's your sense of adventure ! Think about all the modern day explorers, crawling through this code base like cartographers trying to map the sources of Nile, choping their ways throught the jungle, the moskitos swarms of pointers to things yet to be discovered, the...

    And what a high level of creativity this is.

  • (nodebb)
    I won't pick on names here, as they're clearly anonymized.

    Remy, shouldn't you know better by now?

  • (nodebb)

    What about the WTF of them missing out the const reference for the invec parameter?

  • (author) in reply to Dragnslcr

    I had a little more context from the submitter, in this case that let me say that. ;)

  • (nodebb) in reply to Greg
    Comment held for moderation.
  • (nodebb)

    Is

    thingy.get<1>() = lookupValue(thingy.get<0>());

    missing a pointer dereference?

    *(thingy.get<1>()) = lookupValue(thingy.get<0>());

  • Marian (unregistered)

    I think about 15% of WTFs would go away if we all followed that rule.

    30%, by just iterating twice. I am sure.

Leave a comment on “A Pair of Loops”

Log In or post as a guest

Replying to comment #:

« Return to Article