Skip to content

Commit 0f83581

Browse files
committed
xr_stack refactoring:
Added XXX Used size_type for size() instead of u32 Added two new functions
1 parent 4c332f6 commit 0f83581

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/xrCommon/xr_stack.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#pragma once
22
#include "xr_vector.h"
3+
//#include <stack>
34

5+
// XXX: Use standard implementation?
6+
//template <typename T, class container = xr_vector<T>>
7+
//using xr_stack = std::stack<T, container>;
8+
9+
// XXX: Use profiler or something to know if this is faster than std::stack
410
template <typename _Ty, class _C = xr_vector<_Ty>>
511
class xr_stack
612
{
@@ -12,9 +18,11 @@ class xr_stack
1218

1319
allocator_type get_allocator() const { return c.get_allocator(); }
1420
bool empty() const { return c.empty(); }
15-
u32 size() const { return c.size(); }
21+
size_type size() const { return c.size(); }
1622
value_type& top() { return c.back(); }
1723
const value_type& top() const { return c.back(); }
24+
void emplace(value_type&& _X) { c.emplace_back(_X); }
25+
void push(value_type&& _X) { c.push_back(std::move(_X)); }
1826
void push(const value_type& _X) { c.push_back(_X); }
1927
void pop() { c.pop_back(); }
2028
bool operator==(const _Myt& _X) const { return c == _X.c; }

0 commit comments

Comments
 (0)