5#ifndef _COLLECTION2_STACK_H_
6#define _COLLECTION2_STACK_H_
12namespace collection2 {
20template <
typename Element,
typename Size =
size_t>
26 Element*
const internalData;
31 Size internalDataSize;
45 Stack(Element*
const data,
const Size& dataSize);
74 return internalDataSize;
92 return sp < internalDataSize;
105template <
typename Element,
typename Size>
108template <
typename Element,
typename Size>
112 return OperationResult::Overflow;
116 *(internalData + sp) = data;
119 return OperationResult::Success;
122template <
typename Element,
typename Size>
126 return OperationResult::Empty;
131 *data = *(internalData + sp);
132 return OperationResult::Success;
スタック
Definition: stack.hpp:21
Size capacity() const
スタックの全体長を返す
Definition: stack.hpp:73
Stack(Element *const data, const Size &dataSize)
内部データを扱う領域とそのサイズを指定してスタックを初期化
Definition: stack.hpp:106
OperationResult push(const Element &data)
スタックにデータを追加
Definition: stack.hpp:109
bool isEmpty() const
スタックが空かどうか
Definition: stack.hpp:100
OperationResult pop(Element *const data)
スタックからデータを取り出し
Definition: stack.hpp:123
Size amount() const
現在スタック内にあるデータ数を返す
Definition: stack.hpp:82
bool hasSpace() const
スタックに値を追加できるか
Definition: stack.hpp:91
OperationResult
コレクション操作結果
Definition: common.hpp:14