std: add consuming iterators for `HashMap` and `HashSet`

This partially addresses #7719.