Reapplying r203299 in a slightly different manner. Now range APIs are implemented in terms of iterator APIs.