c++ - Why does STL set have count() when all elements are supposed to be unique? -
i can understand multiset has count(), counting number of occurrences of value, because elements can repeated in multiset. what's point of having count() in set, when values unique?
count part of associative container requirements(1).
every associative container required provide part of interface, if result 0 or 1 case std::set.
(1) link sgi stl documentation describing associative container concept; concept defined in c++ standard may differ slightly, not substantially.
Comments
Post a Comment