tags:

views:

262

answers:

2

That is, the computational complexity. Does it have to count all the elements? Does it depend on implementation? The SGI spec doesn't guarantee anything.

+4  A: 

The current C++ standard doesn't specify a hash_set, so yes, it is implementation dependent. I find it a bit hard to imagine an acceptable implementation for which this wouldn't be constant time, however.

anon
A: 

Unspecified, as far as I know, but probably constant time. The Microsoft implementation is constant time.

Tim Sylvester