From 50877a4b7aac0112aec3e33d15fd58948cd2d7ee Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 5 Apr 2016 23:35:56 +0300 Subject: [PATCH] Fixed emplace() function --- cds/container/striped_map/std_list.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cds/container/striped_map/std_list.h b/cds/container/striped_map/std_list.h index b4368383..10080dd1 100644 --- a/cds/container/striped_map/std_list.h +++ b/cds/container/striped_map/std_list.h @@ -194,10 +194,10 @@ namespace cds { namespace intrusive { namespace striped_set { template bool emplace( K&& key, Args&&... args ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); - if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) { - //value_type newItem( key ); - it = m_List.emplace( it, value_type( std::forward(key), std::move( mapped_type( std::forward(args)...) )) ); + value_type val( key_type( std::forward( key )), mapped_type( std::forward( args )... )); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val.first, find_predicate() ); + if ( it == m_List.end() || key_comparator()( val.first, it->first ) != 0 ) { + it = m_List.emplace( it, std::move( val )); # if !defined(CDS_STD_LIST_SIZE_CXX11_CONFORM) ++m_nSize; -- 2.34.1