From b3771184ea87edc60358dc99813aa5d59c757169 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 13 Jun 2015 00:05:11 +0300 Subject: [PATCH] Replaced a functor with lambda in TreiberStack --- cds/intrusive/details/node_traits.h | 1 + cds/intrusive/treiber_stack.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 -- 2.34.1