We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5c9055 commit 2586a43Copy full SHA for 2586a43
1 file changed
src/util/statman.cpp
@@ -15,6 +15,7 @@
15
// See the License for the specific language governing permissions and
16
// limitations under the License.
17
18
+#include <iterator>
19
#include <statman>
20
21
// Stat
@@ -76,15 +77,10 @@ Statman::Statman(uintptr_t start, Size_type num_bytes)
76
77
}
78
79
Statman::Span_iterator Statman::last_used() {
- int i = 0;
80
-
81
- for(auto it = stats_.begin(); it not_eq stats_.end(); ++it) {
82
- if(i == next_available_)
83
- return it;
84
- i++;
85
- }
86
87
- return stats_.end();
+ Expects(next_available_ <= stats_.size());
+ auto it = stats_.begin();
+ std::advance(it, next_available_);
+ return it;
88
89
90
Stat& Statman::create(const Stat::stat_type type, const std::string& name) {
0 commit comments