Skip to content

Commit f25a1be

Browse files
committed
Use std::stack for xr_stack
There's no difference basically..
1 parent 06fa47c commit f25a1be

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

src/xrCommon/xr_stack.h

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,8 @@
11
#pragma once
2+
#include <stack>
23
#include "xr_vector.h"
3-
//#include <stack>
44

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
10-
template <typename _Ty, class _C = xr_vector<_Ty>>
11-
class xr_stack
12-
{
13-
public:
14-
using allocator_type = typename _C::allocator_type;
15-
using value_type = typename allocator_type::value_type;
16-
using size_type = typename allocator_type::size_type;
17-
using _Myt = xr_stack<_Ty, _C>;
18-
19-
allocator_type get_allocator() const { return c.get_allocator(); }
20-
bool empty() const { return c.empty(); }
21-
size_type size() const { return c.size(); }
22-
value_type& top() { return c.back(); }
23-
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)); }
26-
void push(const value_type& _X) { c.push_back(_X); }
27-
void pop() { c.pop_back(); }
28-
bool operator==(const _Myt& _X) const { return c == _X.c; }
29-
bool operator!=(const _Myt& _X) const { return !(*this == _X); }
30-
bool operator<(const _Myt& _X) const { return c < _X.c; }
31-
bool operator>(const _Myt& _X) const { return _X < *this; }
32-
bool operator<=(const _Myt& _X) const { return !(_X < *this); }
33-
bool operator>=(const _Myt& _X) const { return !(*this < _X); }
34-
35-
protected:
36-
_C c;
37-
};
5+
template <typename T, class container = xr_vector<T>>
6+
using xr_stack = std::stack<T, container>;
387

398
#define DEFINE_STACK(T, N) using N = xr_stack<T>;

0 commit comments

Comments
 (0)