From: khizmax Date: Fri, 12 Jun 2015 21:05:11 +0000 (+0300) Subject: Replaced a functor with lambda in TreiberStack X-Git-Tag: v2.1.0~203 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b3771184ea87edc60358dc99813aa5d59c757169;p=libcds.git Replaced a functor with lambda in TreiberStack --- diff --git a/cds/intrusive/details/node_traits.h b/cds/intrusive/details/node_traits.h index df529608..bb14facc 100644 --- a/cds/intrusive/details/node_traits.h +++ b/cds/intrusive/details/node_traits.h @@ -151,6 +151,7 @@ namespace cds { namespace intrusive { //@cond /// Functor converting container's node type to value type + //TODO: delete template struct node_to_value { typename Container::value_type * operator()( typename Container::node_type * p ) const diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index 74ca175c..aac61cd2 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -650,7 +650,6 @@ namespace cds { namespace intrusive { typedef treiber_stack::details::elimination_backoff elimination_backoff; elimination_backoff m_Backoff; - typedef intrusive::node_to_value node_to_value; typedef treiber_stack::operation< value_type > operation_desc; // GC and node_type::gc must be the same @@ -746,7 +745,10 @@ namespace cds { namespace intrusive { } while ( true ) { - node_type * t = guard.protect( m_Top, node_to_value() ); + node_type * t = guard.protect( m_Top, + []( node_type * p ) -> value_type * { + return node_traits::to_value_ptr( p ); + }); if ( t == nullptr ) return nullptr; // stack is empty