stdgpu: stdgpu::stack< T, ContainerT > — stdgpu Latest documentation (original) (raw)
stack< T, ContainerT >#
stdgpu: stdgpu::stack< T, ContainerT >
stdgpu Latest
Efficient STL-like Data Structures on the GPU
- stdgpu
- stack
template<typename T, typename ContainerT = deque>
class stdgpu::stack< T, ContainerT >
A generic container similar to std::stack on the GPU.
Template Parameters
| T | The type of the stored elements |
|---|---|
| ContainerT | The type of the underlying container |
Differences to std::stack:
- index_type instead of size_type
- Manual allocation and destruction of container required
- No guaranteed valid state when reaching capacity limit
- Additional non-standard capacity functions full(), capacity(), and valid()
- Several member functions missing
| Public Types | |
|---|---|
| using | const_reference = typename ContainerT::const_reference |
| using | container_type = ContainerT |
| using | index_type = typename ContainerT::index_type |
| using | reference = typename ContainerT::reference |
| using | value_type = typename ContainerT::value_type |
| Public Member Functions | |
|---|---|
| stack ()=default | |
| STDGPU_HOST_DEVICE index_t | capacity () const |
| STDGPU_HOST_DEVICE bool | empty () const |
| STDGPU_HOST_DEVICE bool | full () const |
| STDGPU_DEVICE_ONLY pair< T, bool > | pop () |
| STDGPU_DEVICE_ONLY bool | push (const T &element) |
| STDGPU_HOST_DEVICE index_t | size () const |
| bool | valid () const |