typedef typename base_class::stat stat; ///< Internal statistics policy used
typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option
+ static CDS_CONSTEXPR const size_t c_nHazardPtrCount = base_class::c_nHazardPtrCount; ///< Count of hazard pointer required for the algorithm
+
protected:
typedef typename maker::node_type node_type; ///< queue node type (derived from intrusive::basket_queue::node)
return false;
}
+ /// Enqueues \p val value into the queue, move semantics
+ bool enqueue( value_type&& val )
+ {
+ scoped_node_ptr p( alloc_node_move( std::move( val )));
+ if ( base_class::enqueue( *p ) ) {
+ p.release();
+ return true;
+ }
+ return false;
+ }
+
/// Enqueues \p data to queue using a functor
/**
\p Func is a functor called to create node.
}
/// Synonym for \p enqueue() function
- bool push( const value_type& val )
+ bool push( value_type const& val )
{
return enqueue( val );
}
+ /// Synonym for \p enqueue() function, move semantics
+ bool push( value_type&& val )
+ {
+ return enqueue( std::move( val ));
+ }
+
/// Synonym for \p enqueue_with() function
template <typename Func>
bool push_with( Func f )
typedef MoirQueue< GC2, T2, Traits2 > other ; ///< Rebinding result
};
+ static CDS_CONSTEXPR const size_t c_nHazardPtrCount = base_class::c_nHazardPtrCount; ///< Count of hazard pointer required for the algorithm
+
public:
typedef T value_type ; ///< Value type stored in the queue
typedef typename base_class::gc gc; ///< Garbage collector
/// Enqueues \p val value into the queue.
/**
The function makes queue node in dynamic memory calling copy constructor for \p val
- and then it calls intrusive::MoirQueue::enqueue.
+ and then it calls \p intrusive::MoirQueue::enqueue.
Returns \p true if success, \p false otherwise.
*/
bool enqueue( value_type const& val )
return false;
}
+ /// Enqueues \p val value into the queue, move semantics
+ bool enqueue( value_type&& val )
+ {
+ scoped_node_ptr p( alloc_node_move( std::move( val )));
+ if ( base_class::enqueue( *p ) ) {
+ p.release();
+ return true;
+ }
+ return false;
+ }
+
/// Enqueues \p data to queue using a functor
/**
\p Func is a functor calling to create a new node.
return enqueue( val );
}
+ /// Synonym for \p enqueue() function, move semantics
+ bool push( value_type&& val )
+ {
+ return enqueue( std::move( val ));
+ }
+
/// Synonym for \p enqueue_with() function
template <typename Func>
bool push_with( Func f )
typedef typename base_class::stat stat; ///< Internal statistics policy used
typedef typename base_class::memory_model memory_model; ///< Memory ordering. See cds::opt::memory_model option
+ static CDS_CONSTEXPR const size_t c_nHazardPtrCount = base_class::c_nHazardPtrCount; ///< Count of hazard pointer required for the algorithm
+
protected:
//@cond
typedef typename maker::node_type node_type; ///< queue node type (derived from \p intrusive::msqueue::node)
/// Enqueues \p val value into the queue.
/**
The function makes queue node in dynamic memory calling copy constructor for \p val
- and then it calls intrusive::MSQueue::enqueue.
+ and then it calls \p intrusive::MSQueue::enqueue.
Returns \p true if success, \p false otherwise.
*/
bool enqueue( value_type const& val )
return false;
}
+ /// Enqueues \p val in the queue, move semantics
+ bool enqueue( value_type&& val )
+ {
+ scoped_node_ptr p( alloc_node_move( std::move( val )));
+ if ( base_class::enqueue( *p ) ) {
+ p.release();
+ return true;
+ }
+ return false;
+ }
+
/// Enqueues data to the queue using a functor
/**
\p Func is a functor called to create node.
return enqueue( val );
}
+ /// Synonym for \p enqueue() function
+ bool push( value_type&& val )
+ {
+ return enqueue( std::move( val ));
+ }
+
/// Synonym for \p enqueue_with() function
template <typename Func>
bool push_with( Func f )
return false;
}
+ /// Enqueues \p val value into the queue, move semntics
+ bool enqueue( value_type&& val )
+ {
+ scoped_node_ptr p( alloc_node_move( std::move( val )));
+ if ( base_class::enqueue( *p ) ) {
+ p.release();
+ return true;
+ }
+ return false;
+ }
+
/// Enqueues \p data to queue using a functor
/**
\p Func is a functor called to create node.
return false;
}
- /// Synonym for \p enqueue() function
+ /// Synonym for \p enqueue( const value_type& ) function
bool push( const value_type& val )
{
return enqueue( val );
}
+ /// Synonym for \p enqueue( value_type&& ) function
+ bool push( value_type&& val )
+ {
+ return enqueue( std::move( val ));
+ }
+
/// Synonym for \p enqueue_with() function
template <typename Func>
bool push_with( Func f )
typedef T value_type; ///< Type of value to be stored in the queue
typedef Traits traits; ///< Queue traits
- typedef typename traits::lock_type lock_type; ///< Locking primitive
+ typedef typename traits::lock_type lock_type; ///< Locking primitive
typedef typename traits::item_counter item_counter; ///< Item counting policy used
protected:
return false;
}
+ /// Enqueues \p data, move semantics
+ bool enqueue( value_type&& data )
+ {
+ scoped_node_ptr p( alloc_node_move( std::move( data )));
+ if ( enqueue_node( p.get() ) ) {
+ p.release();
+ return true;
+ }
+ return false;
+ }
+
/// Enqueues \p data to the queue using a functor
/**
\p Func is a functor called to create node.
return false;
}
- /// Synonym for \p enqueue() function
+ /// Synonym for \p enqueue( value_type const& ) function
bool push( value_type const& val )
{
return enqueue( val );
}
+ /// Synonym for \p enqueue( value_type&& ) function
+ bool push( value_type&& val )
+ {
+ return enqueue( std::move( val ));
+ }
+
/// Synonym for \p enqueue_with() function
template <typename Func>
bool push_with( Func f )
m_Head.ptr = m_Head.ptr->m_pNext.load( atomics::memory_order_relaxed );
free_node( pHead );
}
+ m_ItemCounter.reset();
}
/// Returns queue's item count