/*
This file is a part of libcds - Concurrent Data Structures library
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_CONTAINER_IMPL_ELLEN_BINTREE_SET_H
bool insert( Q const& val )
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
- if ( base_class::insert( *sp.get() )) {
+ if ( base_class::insert( *sp.get())) {
sp.release();
return true;
}
bool insert( Q const& val, Func f )
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
- if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { f( val.m_Value ); } )) {
+ if ( base_class::insert( *sp.get(), [&f]( leaf_node& v ) { f( v.m_Value ); } )) {
sp.release();
return true;
}
bool emplace( Args&&... args )
{
scoped_node_ptr sp( cxx_leaf_node_allocator().MoveNew( std::forward<Args>(args)... ));
- if ( base_class::insert( *sp.get() )) {
+ if ( base_class::insert( *sp.get())) {
sp.release();
return true;
}
*/
guarded_ptr extract_min()
{
- guarded_ptr gp;
- base_class::extract_min_( gp.guard() );
- return gp;
+ return guarded_ptr( base_class::extract_min_());
}
/// Extracts an item with maximal key from the set
*/
guarded_ptr extract_max()
{
- guarded_ptr gp;
- base_class::extract_max_( gp.guard() );
- return gp;
+ return guarded_ptr( base_class::extract_max_());
}
/// Extracts an item from the tree
template <typename Q>
guarded_ptr extract( Q const& key )
{
- guarded_ptr gp;
- base_class::extract_( gp.guard(), key );
- return gp;
+ return base_class::extract_( key );
}
/// Extracts an item from the set using \p pred for searching
guarded_ptr extract_with( Q const& key, Less pred )
{
CDS_UNUSED( pred );
- guarded_ptr gp;
- base_class::extract_with_( gp.guard(), key,
+ return base_class::extract_with_( key,
cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >());
- return gp;
}
/// Find the key \p key
template <typename Q>
guarded_ptr get( Q const& key )
{
- guarded_ptr gp;
- base_class::get_( gp.guard(), key );
- return gp;
+ return base_class::get_( key );
}
/// Finds \p key with predicate \p pred and returns the item found
guarded_ptr get_with( Q const& key, Less pred )
{
CDS_UNUSED(pred);
- guarded_ptr gp;
- base_class::get_with_( gp.guard(), key,
- cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >() );
- return gp;
+ return base_class::get_with_( key,
+ cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >());
}
/// Clears the set (not atomic)
this sequence
\code
set.clear();
- assert( set.empty() );
+ assert( set.empty());
\endcode
the assertion could be raised.