Replaced size() with std::distance.