It was said to me that the standard template library is differently implemented by every compiler, is this correct?
How can computational complexity (both in time an
An example of the actual standard may be helpful to clarify, and unordered_* is a good one I think, since it was added specifically to get a hash table into the standard. This quote is from a draft but I expect the final version is substantially similar:
23.5.4.4 unordered_map modifiers
templatepair insert(P&& obj);
- Requires: value_type is constructible from
std::forward.(obj)
- Effects: Inserts obj converted to value_type if and only if there is no element in the container with key equivalent to the key of
value_type(obj).- Returns: The
boolcomponent of the returned pair object indicates whether the insertion took place and the iterator component points to the element with key equivalent to the key ofvalue_type(obj).- Complexity: Average case O(1), worst case O(size()).
- Remarks: This signature shall not participate in overload resolution unless P is implicitly convertible to
value_type.
Other parts of the standard effectively require it be implemented as a hash table too, but I think the important part is that they make complexity requirements.