--- nono/lib/fixedqueue.h 2026/04/29 17:04:28 1.1.1.2 +++ nono/lib/fixedqueue.h 2026/04/29 17:04:40 1.1.1.5 @@ -1,8 +1,11 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // +#pragma once + #include "header.h" #include @@ -83,13 +86,13 @@ class FixedQueue // 要素を覗き見る。 // idx は 0 .. length-1 までで、0 がキューの先頭。 - T Peek(int idx) { + T Peek(int idx) const { // XXX 範囲チェックすべきだがとりあえず return buf[(start + idx) % capacity]; } private: - std::vector buf; // バッファ - uint start = 0; // 開始位置 - uint length = 0; // 現在有効な長さ + std::vector buf {}; // バッファ + uint start {}; // 開始位置 + uint length {}; // 現在有効な長さ };