Comment

Comment by colonwqbang

I find it so strange and unintuitive that a table lookup in STL can actually amend the table to include the key. I don't know of another library that works like that.

    std::map<std::string, std::string> m;
    (void) m["nonexistent"];
    m.size(); // => 1
Is there a historic reason for this strange specification? Or is it just a concession make the "operator=" sugar work better?
parent colonwqbang 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton