I am a Python/Scala/Haskell coder, trying to learn C++ and I am having hard time remembering anything because so many of the names of methods or classes in C++ do not make any sense to me. This is possibly because I do not understand what they actually intend to do. Can you anyone explain these for me:
vector
- vector is such a odd thing to call a list or sequence of things. Why vector?unordered_set
- Why not simply aset
? Since when are sets ordered? Doesn't set implictly mean order does not matter and the ordered version (java's TreeSets) should be explicitly calledordered_set
instead??vector.cend
- What does cend mean? I could not find cend in the English dictionary? Why not simply call it end?emplace
- What does emplace mean? Shouldn't a better word be "insert"?push_back
- Why not simply callpush
orappend
? Isn't the "back" part implicit?- Why does
empty()
return a boolean? Shouldn't it beisEmpty()
? - Also, the
.begin()
and.end()
seems inconsistent.begin()
is a verb whileend()
is a noun in this context. begin denotes to start something whereas it simply returns a pointer to start. Shouldn't the method be called eitherstart
which is a noun and goes well with "end" orbeginning
atleast instead ofbegin
- Also,
list.unique
does not do at all what I think it does - It simply chops of consecutive similar items!?! (huge violation of principal of least astonishment) - funnily you can do unique correctly in linear run time too with an extra hashset
I have a lot more but if I grok the above, I might have an easier time learning C++. Thanks!