map/set/unordered_map/unordered_set are quite bad names, with no information on the underlying structure/algorithms. By using the short name "map" or "set", it tells the programmer this is the default, general implementation that should be used in most cases.
You shouldn't be assuming anything, that is indeed a bad habit. Always read the documentation. I don't believe that was the intended meaning for those names. As a programmer you should know better than to assume that just cause the word is short does not mean it is the best possible implementation. I know Python is willing to break compatibility but C++ isn't. If a new better optimized structure of a set/map is discovered, Python too won't follow this made up rule of yours, at least until they create Python 4 (breaking compataiblity) and no one bothers switching for the next 20 years.
While in reality, in 90 out of 100 cases a hash map is better than a tree map, because you don't need ordering.
While in reality, in 80 out of 90 of those cases, the performance (of map) doesn't matter as it isn't the bottleneck of the program.
almost all books/courses used map/sets in the examples and hords of programmers got used to them. I can see, it is quite hard for C++ guys to unlearn them.
How is it hard to unlearn? They use exactly the same interface, you literally just add "unordered_" to the variable class name. This might be true for anyone that isn't in CS, people that learn one way and even if they are presented with a better, easier, more efficient way they still use the way they first learned as they don't really care or aren't bothered to learn or grow. This is not just limited to "C++ guys(/gals)", but humanity as a whole and every other profession.
While in reality, in 80 out of 90 of those cases, the performance doesn't matter as it isn't the bottleneck of the program
Assuming C++ is pretty much designed around being high-performance, such claim sounds contradictory.
While in reality, in 80 out of 90 of those cases, the performance doesn't matter as it isn't the bottleneck of the program...
At the time map/set was added to C++, hash sets and hash maps were very well known data structures and were already present in some other language standard libraries. C++ designers just made a poor choice, for a performance-oriented language.
How is it hard to unlearn?
I don't know. Just observed the fact. I've seen just too much code using map/set where unordered_ was much better. Maybe people are simply not aware of the existence of unordered containers?
This might be true for anyone that isn't in CS
If so, then this is true for *most* programmers. Most programmers don't have solid CS background.
template <typename Set>
void anyordered_set_intersection(Set &dst, const Set &a, const Set &b){
dst.clear();
for (constauto &i : a)
if (b.find(i) != b.end())
dst.insert(i);
}
Assuming C++ is pretty much designed around being high-performance, such claim sounds contradictory.
You should know better than to follow the bandwagon. It's so fast it doesn't need efficient data structures ;).
At the time map/set was added to C++, hash sets and hash maps were very well known data structures and were already present in some other language standard libraries. C++ designers just made a poor choice, for a performance-oriented language.
So? That doesn't change the fact that your ideology has an inherent flaw, or do you support languages breaking compatibility for such a petty reason?
I don't know. Just observed the fact. I've seen just too much code using map/set where unordered_ was much better. Maybe people are simply not aware of the existence of unordered containers?
Sounds like bias to me, i see this behavior in human beings everywhere, not just in c++. If they are unaware of unordered_map then they are unware of hash maps all together. I remember you saying you are a professor, if that wasn't just a bunch of hot air, you are probably basing that off personal experience with students more often than not. Which tend to be oblivious to how little they actually know.
If so, then this is true for *most* programmers. Most programmers don't have solid CS background.
Indeed most programmers are in it for the job opportunities and not because they enjoy it and want to grow to become something better or for other reasons. I misspoke when i said CS, what i actually meant was people that have a genuine pleasure for programming and a respect for the knowledge they gain with it. Of course the education system is kind of bad, i've seen programmers without CS degrees (or any for that fact) that would put 90 out of 100 students of what universities pump out to shame. It's not something you do without having a desire to learn on your own.
People need to stop taking sentences out of context. The meaning of both those quotes are meaningless without rabidcoder's quotes to give meaning to the pronouns.