queue< T, ContainerT >

queue< T, ContainerT >#

stdgpu: stdgpu::queue< T, ContainerT >
stdgpu Latest
Efficient STL-like Data Structures on the GPU

Detailed Description

template<typename T, typename ContainerT = deque<T>>
class stdgpu::queue< T, ContainerT >

A generic container similar to std::queue on the GPU.

Template Parameters
TThe type of the stored elements
ContainerTThe type of the underlying container

Differences to std::queue:

  • 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

 queue ()=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
 

Static Public Member Functions

static queue< T, ContainerT > createDeviceObject (const index_t &size)
 
static void destroyDeviceObject (queue< T, ContainerT > &device_object)