--- nono/lib/fixedqueue.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/lib/fixedqueue.h 2026/04/29 17:04:34 1.1.1.4 @@ -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 @@ -76,9 +79,14 @@ class FixedQueue return length; } + // 要素が一杯なら true を返す + bool IsFull() const { + return (length >= capacity); + } + // 要素を覗き見る。 // idx は 0 .. length-1 までで、0 がキューの先頭。 - T Peek(int idx) { + T Peek(int idx) const { // XXX 範囲チェックすべきだがとりあえず return buf[(start + idx) % capacity]; }