# FixedQueue

固定長のキューを実装します。

```cpp
template <typename T>
class FixedQueue
```

## 定義・メンバー変数

```cpp
	public:
		typedef uint16_t size_type;
		typedef T value_type;

	private:
		std::unique_ptr<T[]> _p;
		size_type _head;
		size_type _tail;
		size_type _ct;
		size_type _size;
```

## メソッド

### FixedQueue() - コンストラクタ

```cpp
FixedQueue(size_type n)
void setup(size_type n)
```

`n`を最大値としてキューを初期化・生成します。

### setup()

```cpp
void setup(size_type n)
```

`n`を最大値としてキューを初期化・生成します。

### push()

```cpp
void push(T&& c)
void push(const T& c)
```

キューに要素を追加します。

### push\_no\_assign()

```cpp
T* push_no_assign()
```

キューに要素を追加しますが、キュー内部にはデータコピーせず、替わりにキュー内部の要素へのポインタを返します。

### pop()

```cpp
void pop()
```

キューから要素を削除します。

### front()

```cpp
T& front()
```

先頭要素にアクセスします。

### back()

```cpp
T& back()
```

末尾要素にアクセスします。

### operator\[] ()

```cpp
T& operator[] (int i)
```

配列のようにインデックスを指定して、キューの要素にアクセスします。

### pop\_front()

```cpp
T pop_front()
```

キューの先頭要素を戻り値し、またキューよりその要素を削除します。(`pop()`と`front()`の組み合わせです)

### empty()

```cpp
bool empty()
```

キューが空の場合`true`を返します。

### size()

```cpp
size_type size()
```

現在キューにあるアイテム個数を返します。

### capacity()

```cpp
size_type capacity()
```

キューの最大長を返します。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mwm5.twelite.info/0.9-1/references/basics/tweutils/fixedqueue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
