« first day (949 days earlier)      last day (1887 days later) » 

8:27 PM
std::unordered_map<std::string, std::vector<int>> table{};
if (table["foo"].empty()) {
    table["foo"] = std::vector<int>();
    table["foo"].push_back(10);
}
^ I just encountered some code that looks like this
It seems clearly wrong to be calling .empty() on a vector that isn't there yet
but it appears to work fine.
Is this UB or am I missing something?
 
If they set table with something, then its fine?
Reference to the mapped value of the new element if no element with key key existed. Otherwise a reference to the mapped value of the existing element whose key is equivalent to key.
That code is too clever
 
8:56 PM
@Mikhail where's this from?
 
@Mikhail Fair enough
 

« first day (949 days earlier)      last day (1887 days later) »