« first day (4427 days earlier)      last day (511 days later) » 

1:31 AM
 
 
5 hours later…
6:06 AM
@MangaD I don't want my pet chickens just be ordinary chickens, I try to train them as warriors!
 
6:56 AM
One of my chooks.
 
 
8 hours later…
2:51 PM
Hello, C++ fellows. :)
Today, I made this one out of several programs regarding STL containers.
https://github.com/rohanbari/CPlusPlus/blob/master/src/containers/UOSets.cpp
Learning template specialization in-depth alongside revising STL containers.
 
nwp
Just use std::map :P
 
hm, for equality you should check not just the hash, but if the hash matches, verify that the strings also match
just to avoid hash collision
 
 
2 hours later…
4:27 PM
@nwp I made this for self-educational purpose. Also, I have worked with maps.
@PeterT A set cannot have duplicate elements.
So, container = {{"Two"}, {"Two"}} has a single element.
I used std::unordered_set<Object>.
 
nwp
You still don't want container.contains({"same_hash_as_Two"}) to evaluate to true.
 
4:49 PM
@RohanBari std::multiset<std::string> container { "two", "two"}; has two elements though.
 
5:16 PM
@JerryCoffin Yes, I understand. std::multiset can have multiple instances of their elements. However, I programmed about std::unordered_map in that file.
 
 
3 hours later…
8:30 PM
@RohanBari I meant what nwp said, this is important. There is a reason that the requirement for storing in unordered_map and unordered_set is not just the hash function but a full equality comparison too. Otherwise why would the unordered containers not just require std::hash specialization and then compare the resulting size_t hashes? Because collisions are real and not just a myth
 

« first day (4427 days earlier)      last day (511 days later) »