Why is the return type of std::count a ptrdiff_t?

Since count can never be negative, isn't size_t technically the right choice? And what if the count exceeds the range of ptrdiff_t since the theoretical possible size of an array can be size_t?  



EDIT: So far there is no suitable answer as to why the function returns ptrdiff_t. Some explanation gathered from the answers below is that the return type is iterator_traits&lt;InputIterator&gt;::difference_type which is generic and can be anything. Up until that point it makes sense. There are cases where the count may exceed size_t. However, it still does not make sense why the return type is typedef ptrdiff_t iterator_traits&lt;InputIterator&gt;::difference_type for the standard iterators instead of typedef size_t iterator_traits&lt;InputIterator&gt;::difference_type.


Question: Internal Frame Listeners doesn't work with singleton enum function
Answer: The methods of the InternalFrameListener and ComponentListener interfaces won't be called merely by existing. You need to call addInternalFrameListener or addComponentListener on the frame to tell it about your listener.

For example, in the constructor of MyInternalFrame, you want something like:

this.addInternalFrameListener(someInstanceOfTheManagerObject);