|
| | fc_queue (size_type max_size, const allocator_type &alloc=allocator_type()) |
| | Constructor that creates the queue with a maximum size (capacity). More...
|
| |
| | fc_queue (const fc_queue &rhs) |
| | Copy-constructor that copies all elements from another queue. More...
|
| |
| | ~fc_queue () |
| | Destructor. More...
|
| |
| fc_queue & | operator= (const fc_queue &rhs) |
| | Assignment operator that copies all elements from another queue. More...
|
| |
| bool | empty () const noexcept |
| | Checks whether the queue is empty (containing no elements). More...
|
| |
| bool | full () const noexcept |
| | Checks whether the queue is full (containing the maximum allowed elements). More...
|
| |
| size_type | capacity () const noexcept |
| | Gets the maximum number of allowed elements in the queue. More...
|
| |
| size_type | size () const noexcept |
| | Gets the number of existing elements in the queue. More...
|
| |
| reference | front () |
| | Gets the first element in the queue. More...
|
| |
| const_reference | front () const |
| | Gets the first element in the queue. More...
|
| |
| reference | back () |
| | Gets the last element in the queue. More...
|
| |
| const_reference | back () const |
| | Gets the last element in the queue. More...
|
| |
| void | push (const value_type &value) |
| | Inserts a new element at the end of the queue. More...
|
| |
| void | pop () |
| | Discards the first element in the queue. More...
|
| |
| bool | contains (const value_type &value) const |
| | Checks whether the queue contains a specific element. More...
|
| |
| void | swap (fc_queue &rhs) |
| | Exchanges the elements of two queues. More...
|
| |
| allocator_type | get_allocator () const |
| | Gets the allocator of the queue. More...
|
| |
template<class _Tp, class _Alloc = std::allocator<_Tp>>
class nvwa::fc_queue< _Tp, _Alloc >
Class to represent a fixed-capacity queue.
This class has an interface close to std::queue, but it allows very efficient and lockless one-producer, one-consumer access, as long as the producer does not try to queue an element when the queue is already full.
- Parameters
-
| _Tp | the type of elements in the queue |
| _Alloc | allocator to use for memory management |
- Precondition
- _Tp shall be
CopyConstructible and Destructible, and _Alloc shall meet the allocator requirements (Table 28 in the C++11 spec).