C/C++ API Reference
Loading...
Searching...
No Matches
pw::Deque< T, SizeType > Class Template Reference

Overview

template<typename T, typename SizeType = uint16_t>
class pw::Deque< T, SizeType >

Double-ended queue, similar to std::deque, but uses a fixed storage buffer. The buffer is managed externally and may be statically or dynamically allocated.

Deque is not movable. This avoids confusion about which buffer the deque is using, since the buffer is unowned. FixedDeque, which derives from Deque, optionally owns its buffer and supports moving.

To instantiate a Deque with an integrated buffer, see FixedDeque. FixedDeque supports either internal static or external static or dynamic allocation of its buffer.

All Deque constructors and operators are infallible. Other functions assert if operations cannot succeed.

Template Parameters
TWhat is stored in the deque.
SizeTypeHow to store sizes. A smaller size type limits the maximum number of items, but requires slightly less memory.
Inheritance diagram for pw::Deque< T, SizeType >:
pw::FixedDeque< T, kInlineCapacity, S >

Public Types

using const_iterator = containers::internal::DequeIterator< const Derived >
 
using const_pointer = const value_type *
 
using const_reference = const value_type &
 
using difference_type = ptrdiff_t
 
using iterator = containers::internal::DequeIterator< Derived >
 
using pointer = value_type *
 
using reference = value_type &
 
using size_type = SizeType
 
using value_type = ValueType
 

Public Member Functions

constexpr Deque (span< std::byte > unaligned_buffer) noexcept
 
template<size_t kAlignment, size_t kSizeBytes>
constexpr Deque (containers::Storage< kAlignment, kSizeBytes > &buffer) noexcept
 
 Deque (const Deque &)=delete
 Copying is not supported since it can fail.
 
Dequeoperator= (const Deque &)=delete
 
 Deque (Deque &&)=delete
 Move is not supported to avoid confusion about deque/buffer pairings.
 
Dequeoperator= (Deque &&)=delete
 
constexpr size_type max_size () const noexcept
 

Friends

template<typename , typename >
class Queue
 
template<typename , size_t , typename >
class FixedDeque
 

The documentation for this class was generated from the following file: