Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TArrayStack.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <array>
5
6namespace ph
7{
8
14template<typename T, std::size_t N>
15class TArrayStack final
16{
17public:
21
25 template<typename U>
26 void push(U&& item);
27
31 void pop();
32
33 T& top();
34 const T& top() const;
35 std::size_t height() const;
36 void clear();
37 bool isEmpty() const;
38
39 T& operator [] (std::size_t index);
40 const T& operator [] (std::size_t index) const;
41
42private:
43 // Must be signed type
44 using Index = int;
45
46 std::array<T, N> m_data;
47 Index m_currentIndex;
48};
49
50}// end namespace ph
51
A fixed size stack backed by an array. The container inherits the properties of a fixed size array of...
Definition TArrayStack.h:16
void push(U &&item)
Adds an item to the stack. The item originally at the target index will be overwritten.
Definition TArrayStack.ipp:19
T & top()
Definition TArrayStack.ipp:35
std::size_t height() const
Definition TArrayStack.ipp:51
T & operator[](std::size_t index)
Definition TArrayStack.ipp:71
void clear()
Definition TArrayStack.ipp:59
bool isEmpty() const
Definition TArrayStack.ipp:65
TArrayStack()
Definition TArrayStack.ipp:13
void pop()
Removes the top item from the stack. The item originally at the target index is still alive after thi...
Definition TArrayStack.ipp:27
The root for all renderer implementations.
Definition EEngineProject.h:6