projects
/
libcds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move michael_list_base.h from cds/container to cds/container/details
[libcds.git]
/
cds
/
container
/
michael_list_nogc.h
diff --git
a/cds/container/michael_list_nogc.h
b/cds/container/michael_list_nogc.h
index bd07cff4f81817102d1ee08673a355a86fbee788..abae2284d09283d229c7b1e6e5bb4a474d5901ea 100644
(file)
--- a/
cds/container/michael_list_nogc.h
+++ b/
cds/container/michael_list_nogc.h
@@
-3,10
+3,10
@@
#ifndef __CDS_CONTAINER_MICHAEL_LIST_NOGC_H
#define __CDS_CONTAINER_MICHAEL_LIST_NOGC_H
#ifndef __CDS_CONTAINER_MICHAEL_LIST_NOGC_H
#define __CDS_CONTAINER_MICHAEL_LIST_NOGC_H
-#include <cds/container/michael_list_base.h>
+#include <memory>
+#include <cds/container/details/michael_list_base.h>
#include <cds/intrusive/michael_list_nogc.h>
#include <cds/container/details/make_michael_list.h>
#include <cds/intrusive/michael_list_nogc.h>
#include <cds/container/details/make_michael_list.h>
-#include <cds/details/std/memory.h>
namespace cds { namespace container {
namespace cds { namespace container {
@@
-75,25
+75,6
@@
namespace cds { namespace container {
typedef typename base_class::atomic_node_ptr head_type;
//@endcond
typedef typename base_class::atomic_node_ptr head_type;
//@endcond
- protected:
- //@cond
-# ifndef CDS_CXX11_LAMBDA_SUPPORT
- struct ensure_functor
- {
- node_type * m_pItemFound;
-
- ensure_functor()
- : m_pItemFound( NULL )
- {}
-
- void operator ()(bool, node_type& item, node_type& )
- {
- m_pItemFound = &item;
- }
- };
-# endif
- //@endcond
-
protected:
//@cond
static node_type * alloc_node()
protected:
//@cond
static node_type * alloc_node()
@@
-106,13
+87,11
@@
namespace cds { namespace container {
return cxx_allocator().New( v );
}
return cxx_allocator().New( v );
}
-# ifdef CDS_EMPLACE_SUPPORT
template <typename... Args>
static node_type * alloc_node( Args&&... args )
{
return cxx_allocator().MoveNew( std::forward<Args>(args)... );
}
template <typename... Args>
static node_type * alloc_node( Args&&... args )
{
return cxx_allocator().MoveNew( std::forward<Args>(args)... );
}
-# endif
static void free_node( node_type * pNode )
{
static void free_node( node_type * pNode )
{
@@
-174,7
+153,7
@@
namespace cds { namespace container {
value_ptr operator ->() const
{
typename iterator_base::value_ptr p = iterator_base::operator ->();
value_ptr operator ->() const
{
typename iterator_base::value_ptr p = iterator_base::operator ->();
- return p ? &(p->m_Value) :
reinterpret_cast<value_ptr>(NULL)
;
+ return p ? &(p->m_Value) :
nullptr
;
}
value_ref operator *() const
}
value_ref operator *() const
@@
-233,7
+212,7
@@
namespace cds { namespace container {
/// Returns an iterator that addresses the location succeeding the last element in a list
/**
Do not use the value returned by <tt>end</tt> function to access any item.
/// Returns an iterator that addresses the location succeeding the last element in a list
/**
Do not use the value returned by <tt>end</tt> function to access any item.
- Internally, <tt>end</tt> returning value equals to
<tt>NULL</tt>
.
+ Internally, <tt>end</tt> returning value equals to
\p nullptr
.
The returned value can be used only to control reaching the end of the list.
For empty list \code begin() == end() \endcode
The returned value can be used only to control reaching the end of the list.
For empty list \code begin() == end() \endcode
@@
-323,20
+302,15
@@
namespace cds { namespace container {
return std::make_pair( node_to_iterator( ret.first ), ret.second );
}
return std::make_pair( node_to_iterator( ret.first ), ret.second );
}
-# ifdef CDS_EMPLACE_SUPPORT
/// Inserts data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
/**
Return an iterator pointing to inserted item if success \ref end() otherwise
/// Inserts data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
/**
Return an iterator pointing to inserted item if success \ref end() otherwise
-
- This function is available only for compiler that supports
- variadic template and move semantics
*/
template <typename... Args>
iterator emplace( Args&&... args )
{
return node_to_iterator( emplace_at( head(), std::forward<Args>(args)... ));
}
*/
template <typename... Args>
iterator emplace( Args&&... args )
{
return node_to_iterator( emplace_at( head(), std::forward<Args>(args)... ));
}
-# endif
/// Find the key \p val
/** \anchor cds_nonintrusive_MichaelList_nogc_find_val
/// Find the key \p val
/** \anchor cds_nonintrusive_MichaelList_nogc_find_val
@@
-395,12
+369,12
@@
namespace cds { namespace container {
//@cond
node_type * insert_node_at( head_type& refHead, node_type * pNode )
{
//@cond
node_type * insert_node_at( head_type& refHead, node_type * pNode )
{
- assert( pNode != null
_ptr<node_type *>()
);
+ assert( pNode != null
ptr
);
scoped_node_ptr p(pNode);
if ( base_class::insert_at( refHead, *pNode ))
return p.release();
scoped_node_ptr p(pNode);
if ( base_class::insert_at( refHead, *pNode ))
return p.release();
- return null
_ptr<node_type *>()
;
+ return null
ptr
;
}
template <typename Q>
}
template <typename Q>
@@
-413,29
+387,21
@@
namespace cds { namespace container {
std::pair< node_type *, bool > ensure_at( head_type& refHead, const Q& val )
{
scoped_node_ptr pNode( alloc_node( val ));
std::pair< node_type *, bool > ensure_at( head_type& refHead, const Q& val )
{
scoped_node_ptr pNode( alloc_node( val ));
- node_type * pItemFound = null
_ptr<node_type *>()
;
+ node_type * pItemFound = null
ptr
;
-# ifdef CDS_CXX11_LAMBDA_SUPPORT
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode, [&pItemFound](bool, node_type& item, node_type&) { pItemFound = &item; });
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode, [&pItemFound](bool, node_type& item, node_type&) { pItemFound = &item; });
-# else
- ensure_functor func;
- std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode, boost::ref(func) );
- pItemFound = func.m_pItemFound;
-# endif
- assert( pItemFound != null_ptr<node_type *>() );
+ assert( pItemFound != nullptr );
if ( ret.first && ret.second )
pNode.release();
return std::make_pair( pItemFound, ret.second );
}
if ( ret.first && ret.second )
pNode.release();
return std::make_pair( pItemFound, ret.second );
}
-# ifdef CDS_EMPLACE_SUPPORT
template <typename... Args>
node_type * emplace_at( head_type& refHead, Args&&... args )
{
return insert_node_at( refHead, alloc_node( std::forward<Args>(args)...));
}
template <typename... Args>
node_type * emplace_at( head_type& refHead, Args&&... args )
{
return insert_node_at( refHead, alloc_node( std::forward<Args>(args)...));
}
-# endif
template <typename Q, typename Compare>
node_type * find_at( head_type& refHead, Q const& key, Compare cmp )
template <typename Q, typename Compare>
node_type * find_at( head_type& refHead, Q const& key, Compare cmp )