]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/container/stack.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / container / stack.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_CONTAINER_STACK_HPP
12 #define BOOST_COMPUTE_CONTAINER_STACK_HPP
13
14 #include <boost/compute/container/vector.hpp>
15
16 namespace boost {
17 namespace compute {
18
19 template<class T>
20 class stack
21 {
22 public:
23 typedef vector<T> container_type;
24 typedef typename container_type::size_type size_type;
25 typedef typename container_type::value_type value_type;
26
27 stack()
28 {
29 }
30
31 stack(const stack<T> &other)
32 : m_vector(other.m_vector)
33 {
34 }
35
36 stack<T>& operator=(const stack<T> &other)
37 {
38 if(this != &other){
39 m_vector = other.m_vector;
40 }
41
42 return *this;
43 }
44
45 ~stack()
46 {
47 }
48
49 bool empty() const
50 {
51 return m_vector.empty();
52 }
53
54 size_type size() const
55 {
56 return m_vector.size();
57 }
58
59 value_type top() const
60 {
61 return m_vector.back();
62 }
63
64 void push(const T &value)
65 {
66 m_vector.push_back(value);
67 }
68
69 void pop()
70 {
71 m_vector.pop_back();
72 }
73
74 private:
75 container_type m_vector;
76 };
77
78 } // end compute namespace
79 } // end boost namespace
80
81 #endif // BOOST_COMPUTE_CONTAINER_STACK_HPP