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_ELLEN_BINTREE_MAP_RCU_H
the priority value plus some uniformly distributed random value.
@warning Recall the tree is <b>unbalanced</b>. The complexity of operations is <tt>O(log N)</tt>
- for uniformly distributed random keys, but in worst case the complexity is <tt>O(N)</tt>.
+ for uniformly distributed random keys, but in the worst case the complexity is <tt>O(N)</tt>.
@note In the current implementation we do not use helping technique described in original paper.
So, the current implementation is near to fine-grained lock-based tree.
typedef std::pair< key_type const, mapped_type > value_type; ///< Key-value pair stored in leaf node of the mp
typedef Traits traits; ///< Traits template parameter
+ static_assert( std::is_default_constructible<key_type>::value, "Key should be default constructible type" );
+
# ifdef CDS_DOXYGEN_INVOKED
typedef implementation_defined key_comparator ; ///< key compare functor based on \p Traits::compare and \p Traits::less
# else
template <typename K, typename... Args>
bool emplace( K&& key, Args&&... args )
{
- scoped_node_ptr pNode( cxx_leaf_node_allocator().New( std::forward<K>(key), std::forward<Args>(args)... ));
+ scoped_node_ptr pNode( cxx_leaf_node_allocator().MoveNew( key_type( std::forward<K>(key)), mapped_type( std::forward<Args>(args)... )));
if ( base_class::insert( *pNode )) {
pNode.release();
return true;
RCU \p synchronize() method can be called. RCU should not be locked.
- Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
+ Returns std::pair<bool, bool> where \p first is \p true if operation is successful,
i.e. the node has been inserted or updated,
\p second is \p true if new item has been added or \p false if the item with \p key
already exists.
{
CDS_UNUSED( pred );
return exempt_ptr( base_class::extract_with_( key,
- cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ));
+ cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >()));
}
/// Find the key \p key
bool contains( K const& key, Less pred )
{
CDS_UNUSED( pred );
- return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() );
+ return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >());
}
//@cond
template <typename K, typename Less>