>unordered_map<int, int> A;>if (A.find(42) != A.end())>A = {}>if 42 in Awhy is C++ so cucked compared to python?
>>108361606No clue, I just use AI
>>108361606>A = {}not an unordered map since Python 3.7
>>108361606>unordered_map<int, int> A;you can drop the template parameters if the compiler can deduce them, e.g.unordered_map A {{1, 10}, {2, 20}};>if (A.find(42) != A.end())if(A.contains(42))it's been in the language for 6 years now
unordered_map A {{1, 10}, {2, 20}};
if(A.contains(42))
>>108361723>not possible in c++17
>>108361723>containsbuddy we're still on C++17 here
>>108361773usecase for using outdated C++ standards?
>>108361773>>108361792skill issue, everything in c++20 but memedules has been implemented in all 3 major compilers for years
>>108361606>the users of Guido's slow webshit language are beefing with the users of Bjarne's fast schizophrenia languageCute. Have you read your SICP today?
>>108361802employment>>108361816see above. strict C++17 compliance until we increment the whole stack.
>>108361606find returns the iterator so you can also get the element. Not really seeing the problem here. Similar to rust hashmaps returning a Option<V> for #get.
>>108361832
It’s the consequence of trying to improve an already perfect language
>>108361946op is mad that you have to manually write the ".contains()" implementation every time
>>108361946and what if you don't need the element?
>>108361773>17holy unc
>>108362832some people work for their own keep rather than leeching off mommy
>>108361606Different priorities. People with other use cases are asking why Python is so cucked compared to C++, being 50-200x slower or smth.
>>108361606>if 42 in Aif 42 in A what?
>>108361914Must be a shitty fucking company then. I bet they also use java 8.
>>108362820when the fuck would you not?the number of times I needed to see if something was in a hashmap but not get the value has been pretty slim.
that python code is the same asif a.keys().__contains__(42)it is just hidden. dont given the c++ committee any ideas.
if a.keys().__contains__(42)
>>108361606which is faster?
>>108361606Why are you looking for a number in an empty map? Are you retarded?
>>108362839Get a better job, you boomerware janny.
console.log(typeof null);>object
console.log(typeof null);
>>108365317boomerware still runs c++98
>>108365674Everything below 20 is boomerware.
>>108361641It's an insertion-ordered map, which is a different thing, a combination of hash table and linked list. Basically, you can think of it as keeping the hash buckets in a deque as well so that the order is preserved, but the deque isn't used for looking things up by key (as that's what the hash table does). It's a touch more complex than that, but not much and it works really well.Cost: extra two pointers per entry in the dict (and a little overhead per dict to hold the head and tail pointers).
>>108361606>>108361633Indians