Ponca  eb7239a9c07e156fb1edc6faac7fe89e2b256bda
Point Cloud Analysis library
Loading...
Searching...
No Matches
stack.hpp
1
8
9namespace Ponca
10{
11 template <class T, int N>
12 Stack<T, N>::Stack() : m_size(0), m_data()
13 {
14 }
15
16 template <class T, int N>
17 const T& Stack<T, N>::top() const
18 {
19 return STD_SAFE_AT(m_data, m_size - 1);
20 }
21
22 template <class T, int N>
24 {
25 return STD_SAFE_AT(m_data, m_size - 1);
26 }
27
28 template <class T, int N>
29 bool Stack<T, N>::empty() const
30 {
31 return m_size == 0;
32 }
33
34 template <class T, int N>
36 {
37 return m_size;
38 }
40 template <class T, int N>
41 void Stack<T, N>::push(const T& value)
42 {
43 STD_SAFE_AT(m_data, m_size) = value;
44 ++m_size;
45 }
46
47 template <class T, int N>
49 {
50 ++m_size;
51 }
53 template <class T, int N>
55 {
56 --m_size;
57 }
58
59 template <class T, int N>
61 {
62 m_size = 0;
63 }
64
65} // namespace Ponca
void clear()
Clear the stack content.
Definition stack.hpp:60
std::array< T, N > m_data
Fixed-size data buffer.
Definition stack.h:61
void pop()
Pop the last element of the Stack.
Definition stack.hpp:54
int size() const
Get the number of elements in the Stack.
Definition stack.hpp:35
void push(const T &value)
Add an element on top of the stack.
Definition stack.hpp:41
int m_size
Number of elements in the Stack.
Definition stack.h:59
bool empty() const
Is the stack empty.
Definition stack.hpp:29
const T & top() const
Read access to the top element of the Stack.
Definition stack.hpp:17
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11