BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::queue< VALUE, CONTAINER > Class Template Reference

#include <bslstl_queue.h>

Public Types

typedef CONTAINER::value_type value_type
 
typedef CONTAINER::reference reference
 
typedef CONTAINER::const_reference const_reference
 
typedef CONTAINER::size_type size_type
 
typedef CONTAINER container_type
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION_IF (queue, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< container_type >::value)
 
 queue ()
 
 queue (const queue &original)
 Create a queue having the value of the specified original.
 
 queue (BloombergLP::bslmf::MovableRef< queue > container)
 
 queue (const CONTAINER &container)
 
 queue (BloombergLP::bslmf::MovableRef< CONTAINER > container)
 
template<class ALLOCATOR >
 queue (const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0)
 
template<class ALLOCATOR >
 queue (const CONTAINER &container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0)
 
template<class ALLOCATOR >
 queue (const queue &original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0)
 
template<class ALLOCATOR >
 queue (BloombergLP::bslmf::MovableRef< CONTAINER > container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0)
 
template<class ALLOCATOR >
 queue (BloombergLP::bslmf::MovableRef< queue > original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0)
 
queueoperator= (const queue &rhs)
 
queueoperator= (BloombergLP::bslmf::MovableRef< queue > rhs)
 
template<class... Args>
reference emplace (Args &&... args)
 
void push (const value_type &value)
 
void push (BloombergLP::bslmf::MovableRef< value_type > value)
 
void pop ()
 
reference back ()
 
bool empty () const
 
size_type size () const
 
const_reference front () const
 
const_reference back () const
 

Public Attributes

void swap(queue &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl reference front ()
 

Protected Attributes

CONTAINER c
 

Friends

template<class VALUE2 , class CONTAINER2 >
bool operator== (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 
template<class VALUE2 , class CONTAINER2 >
bool operator!= (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 
template<class VALUE2 , class CONTAINER2 >
bool operator< (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 
template<class VALUE2 , class CONTAINER2 >
bool operator> (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 
template<class VALUE2 , class CONTAINER2 >
bool operator<= (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 
template<class VALUE2 , class CONTAINER2 >
bool operator>= (const queue< VALUE2, CONTAINER2 > &, const queue< VALUE2, CONTAINER2 > &)
 

Detailed Description

template<class VALUE, class CONTAINER = deque<VALUE>>
class bsl::queue< VALUE, CONTAINER >

This class is a value-semantic class template, having a container of the parameterized CONTAINER type that holds elements of the parameterized VALUE type, to provide a first-in-first-out queue data structure. The container object held by a queue class object is referenced as c in the following function-level documentation.

See bslstl_queue

Member Typedef Documentation

◆ const_reference

template<class VALUE , class CONTAINER = deque<VALUE>>
typedef CONTAINER::const_reference bsl::queue< VALUE, CONTAINER >::const_reference

◆ container_type

template<class VALUE , class CONTAINER = deque<VALUE>>
typedef CONTAINER bsl::queue< VALUE, CONTAINER >::container_type

◆ reference

template<class VALUE , class CONTAINER = deque<VALUE>>
typedef CONTAINER::reference bsl::queue< VALUE, CONTAINER >::reference

◆ size_type

template<class VALUE , class CONTAINER = deque<VALUE>>
typedef CONTAINER::size_type bsl::queue< VALUE, CONTAINER >::size_type

◆ value_type

template<class VALUE , class CONTAINER = deque<VALUE>>
typedef CONTAINER::value_type bsl::queue< VALUE, CONTAINER >::value_type

Constructor & Destructor Documentation

◆ queue() [1/10]

template<class VALUE , class CONTAINER >
bsl::queue< VALUE, CONTAINER >::queue ( )
inlineexplicit

Create an empty queue having a container of the parameterized CONTAINER type.

◆ queue() [2/10]

template<class VALUE , class CONTAINER >
bsl::queue< VALUE, CONTAINER >::queue ( const queue< VALUE, CONTAINER > &  original)
inline

◆ queue() [3/10]

template<class VALUE , class CONTAINER >
bsl::queue< VALUE, CONTAINER >::queue ( BloombergLP::bslmf::MovableRef< queue< VALUE, CONTAINER > >  container)
inline

Create a queue having the value of the specified original. The allocator associated with original (if any) is propagated for use in the new queue. original is left in valid but unspecified state.

◆ queue() [4/10]

template<class VALUE , class CONTAINER >
bsl::queue< VALUE, CONTAINER >::queue ( const CONTAINER &  container)
inlineexplicit

Create a queue having the specified container that holds elements of the parameterized VALUE type.

◆ queue() [5/10]

template<class VALUE , class CONTAINER >
bsl::queue< VALUE, CONTAINER >::queue ( BloombergLP::bslmf::MovableRef< CONTAINER >  container)
inlineexplicit

Create a queue having the same sequence of values as the specified container. The allocator associated with container (if any) is propagated for use in the new queue. container is left in valid but unspecified state.

◆ queue() [6/10]

template<class VALUE , class CONTAINER >
template<class ALLOCATOR >
bsl::queue< VALUE, CONTAINER >::queue ( const ALLOCATOR &  basicAllocator,
typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *  = 0 
)
inlineexplicit

Create an empty queue. This queue object uses the specified basicAllocator to supply memory. Note that the ALLOCATOR parameter type has to be convertible to the allocator of the CONTAINER parameter type, CONTAINER::allocator_type; otherwise, this constructor is disabled.

◆ queue() [7/10]

template<class VALUE , class CONTAINER >
template<class ALLOCATOR >
bsl::queue< VALUE, CONTAINER >::queue ( const CONTAINER &  container,
const ALLOCATOR &  basicAllocator,
typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *  = 0 
)
inline

Create a queue having the same sequence of values as the specified container. The queue object uses the specified basicAllocator to obtain memory. Note that the ALLOCATOR parameter type has to be convertible to the allocator of the CONTAINER parameter type, CONTAINER::allocator_type; otherwise, this constructor is disabled.

◆ queue() [8/10]

template<class VALUE , class CONTAINER >
template<class ALLOCATOR >
bsl::queue< VALUE, CONTAINER >::queue ( const queue< VALUE, CONTAINER > &  original,
const ALLOCATOR &  basicAllocator,
typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *  = 0 
)
inline

Create a queue having the value of the specified original that will use the specified basicAllocator to supply memory. Note that the ALLOCATOR parameter type has to be convertible to the allocator of the CONTAINER parameter type, CONTAINER::allocator_type. Otherwise this constructor is disabled.

◆ queue() [9/10]

template<class VALUE , class CONTAINER >
template<class ALLOCATOR >
bsl::queue< VALUE, CONTAINER >::queue ( BloombergLP::bslmf::MovableRef< CONTAINER >  container,
const ALLOCATOR &  basicAllocator,
typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *  = 0 
)
inline

Create a queue whose underlying container has the value of the specified container (on entry) and uses basicAllocator to supply memory. The allocated-extended move constructor of CONTAINER is used to create the new queue. container is left in a valid but unspecified state. Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default). Also note that this method assumes that CONTAINER has a move constructor. Also note that if CONTAINER::allocator_type does not exist, this constructor is disabled.

◆ queue() [10/10]

template<class VALUE , class CONTAINER >
template<class ALLOCATOR >
bsl::queue< VALUE, CONTAINER >::queue ( BloombergLP::bslmf::MovableRef< queue< VALUE, CONTAINER > >  original,
const ALLOCATOR &  basicAllocator,
typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *  = 0 
)
inline

Create a queue having the value of the specified original (on entry), that uses basicAllocator to supply memory. The allocator-extended move constructor of CONTAINER is used to create the new queue. original is left in a valid but unspecified state. Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default). Also note that this method assumes that CONTAINER has a move constructor. Also note that if CONTAINER::allocator_type does not exist, this constructor is disabled.

Member Function Documentation

◆ back() [1/2]

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER >::reference bsl::queue< VALUE, CONTAINER >::back ( )
inline

Return a reference providing modifiable access to the back (the latest pushed) element of this queue object.

◆ back() [2/2]

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER >::const_reference bsl::queue< VALUE, CONTAINER >::back ( ) const
inline

Return the immutable back (the latest pushed) element from this queue object. In effect, performs c.back().

◆ BSLMF_NESTED_TRAIT_DECLARATION_IF()

template<class VALUE , class CONTAINER = deque<VALUE>>
bsl::queue< VALUE, CONTAINER >::BSLMF_NESTED_TRAIT_DECLARATION_IF ( queue< VALUE, CONTAINER >  ,
BloombergLP::bslma::UsesBslmaAllocator  ,
BloombergLP::bslma::UsesBslmaAllocator< container_type >::value   
)

◆ emplace()

template<class VALUE , class CONTAINER >
template<class... Args>
queue< VALUE, CONTAINER >::reference bsl::queue< VALUE, CONTAINER >::emplace ( Args &&...  args)
inline

Push onto this queue a newly created value_type object constructed by forwarding get_allocator() (if required) and the specified (variable number of) args to the corresponding constructor of value_type. Return a reference providing modifiable access to the inserted element.

◆ empty()

template<class VALUE , class CONTAINER >
bool bsl::queue< VALUE, CONTAINER >::empty ( ) const
inline

Return true if this queue object contains no elements, and false otherwise. In effect, performs return c.empty();.

◆ front()

template<class VALUE , class CONTAINER = deque<VALUE>>
const_reference bsl::queue< VALUE, CONTAINER >::front ( ) const

Return the immutable front (the earliest pushed) element from this queue object. In effect, performs c.front().

◆ operator=() [1/2]

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER > & bsl::queue< VALUE, CONTAINER >::operator= ( BloombergLP::bslmf::MovableRef< queue< VALUE, CONTAINER > >  rhs)
inline

Assign to this queue the value as the specified rhs and return a reference providing modifiable access to this queue. The move-assignment operator of CONTAINER is used to set the value of this queue. rhs is left in a valid but unspecified state, and if an exception is thrown, *this is left in a valid but unspecified state.

◆ operator=() [2/2]

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER > & bsl::queue< VALUE, CONTAINER >::operator= ( const queue< VALUE, CONTAINER > &  rhs)
inline

Assign to this queue the value of the specified rhs, and return a reference providing modifiable access to this queue.

◆ pop()

template<class VALUE , class CONTAINER >
void bsl::queue< VALUE, CONTAINER >::pop ( )
inline

◆ push() [1/2]

template<class VALUE , class CONTAINER >
void bsl::queue< VALUE, CONTAINER >::push ( BloombergLP::bslmf::MovableRef< value_type value)
inline

Push onto the back of this queue a value_type object having the value of the specified value (on entry) by moving the contents of value to the new object on this queue. value is left in a valid but unspecified state.

◆ push() [2/2]

template<class VALUE , class CONTAINER >
void bsl::queue< VALUE, CONTAINER >::push ( const value_type value)
inline

Push onto the back of this queue a value_type object having the specified value.

◆ size()

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER >::size_type bsl::queue< VALUE, CONTAINER >::size ( ) const
inline

Return the number of elements in this queue. In effect, performs return c.size();.

Friends And Related Symbol Documentation

◆ operator!=

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator!= ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

◆ operator<

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator< ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

◆ operator<=

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator<= ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

◆ operator==

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator== ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

◆ operator>

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator> ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

◆ operator>=

template<class VALUE , class CONTAINER = deque<VALUE>>
template<class VALUE2 , class CONTAINER2 >
bool operator>= ( const queue< VALUE2, CONTAINER2 > &  ,
const queue< VALUE2, CONTAINER2 > &   
)
friend

Member Data Documentation

◆ c

template<class VALUE , class CONTAINER = deque<VALUE>>
CONTAINER bsl::queue< VALUE, CONTAINER >::c
protected

◆ front

template<class VALUE , class CONTAINER >
queue< VALUE, CONTAINER >::const_reference bsl::queue< VALUE, CONTAINER >::front
inline

Remove the front (the earliest pushed) element from this queue object. Return a reference providing modifiable access to the front (the earliest pushed) element from this queue object.


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