From 5b8ed91ed888ca69e6ed4ae709a63b8a2147ad33 Mon Sep 17 00:00:00 2001 From: khizmax Date: Thu, 5 Mar 2015 17:59:42 +0300 Subject: [PATCH] Tried to fix gcc/clang problem like how to pass argument pack to lambda function --- cds/container/bronson_avltree_map_rcu.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cds/container/bronson_avltree_map_rcu.h b/cds/container/bronson_avltree_map_rcu.h index 8278c6e6..f36f53d2 100644 --- a/cds/container/bronson_avltree_map_rcu.h +++ b/cds/container/bronson_avltree_map_rcu.h @@ -236,19 +236,24 @@ namespace cds { namespace container { template bool emplace( K&& key, Args&&... args ) { - auto helper = []( Args&&... args ) -> mapped_type * +# if CDS_COMPILER != CDS_COMPILER_MSVC + auto helper = []( typename std::decay::type&&... args ) -> mapped_type * { - return cxx_allocator().New( std::forward(args)...); + return cxx_allocator().New( std::move(args)...); }; +# endif return base_class::do_update( key, key_comparator(), - [=]( node_type * pNode ) -> mapped_type * + [&]( node_type * pNode ) -> mapped_type * { assert( pNode->m_pValue.load( memory_model::memory_order_relaxed ) == nullptr ); CDS_UNUSED( pNode ); - return helper( args... ); +# if CDS_COMPILER == CDS_COMPILER_MSVC + return cxx_allocator().New( std::forward(args)...); +# else // gcc/clang error: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226 - //return cxx_allocator().New( std::forward(args)...); + return helper( args... ); +# endif }, update_flags::allow_insert ) == update_flags::result_inserted; -- 2.34.1