Ponca  7df32c91629c89b89840c4d7917cb272433f2d2b
Point Cloud Analysis library
Loading...
Searching...
No Matches
stack.h
1
9#pragma once
10
11#include <array>
12
13#include "../defines.h" //STD_SAFE_AT
14
15namespace Ponca
16{
17
24 template <class T, int N>
25 class Stack
26 {
27 public:
29 using ValueType = T;
30
31 PONCA_MULTIARCH inline Stack();
32
34 PONCA_MULTIARCH inline const T& top() const;
36 PONCA_MULTIARCH inline T& top();
37
39 PONCA_MULTIARCH inline bool empty() const;
41 PONCA_MULTIARCH inline int size() const;
42
45 PONCA_MULTIARCH inline void push(const T& value);
46
48 PONCA_MULTIARCH inline void push();
52 PONCA_MULTIARCH inline void pop();
55 PONCA_MULTIARCH inline void clear();
56
57 protected:
59 int m_size;
61 std::array<T, N> m_data;
62 };
63} // namespace Ponca
64
65#include "stack.hpp"
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:257
Stack with fixed-size storage.
Definition stack.h:26
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
T ValueType
Type of value stored in the Stack.
Definition stack.h:29
void push()
Add an element with default initialization.
Definition stack.hpp:48
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 bitset.h:17