Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The code from the article isn't merely "not idiomatic C++", but I would go so far as to say it's abused or obfuscated C++.

An example of non-idiomatic C++ might be

    for (int I = 0; I < c.size(); I++) {
        Total += c[I].foo;
    }
...instead of using std::accumulate. The code from the article is (humorously pointing out) something else entirely.


Either you come from a very different community of C++ users than I do, or you are using a different definition of "idiomatic" than I am familiar with, because that loop looks like totally ordinary, everyday C++, and is therefore precisely what I'd call "idiomatic", while I can't recall ever having seen anyone actually use std::accumulate in real life. I suppose this is part of the fun of C++, though, in that it supports a family of distinct but compatible dialects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: