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:
typedef typename ordered_list::value_type value_type; ///< type of value to be stored in the list
typedef typename ordered_list::key_comparator key_comparator; ///< key comparison functor
+#ifdef CDS_DOXYGEN_INVOKED
typedef typename ordered_list::stat stat; ///< Internal statistics
+#endif
/// Hash functor for \ref value_type and all its derivatives that you use
typedef typename cds::opt::v::hash_selector< typename traits::hash >::type hash;
static_assert( !std::is_same<item_counter, atomicity::empty_item_counter>::value,
"cds::atomicity::empty_item_counter is not allowed as a item counter");
-#ifdef CDS_DOXYGEN_INVOKED
- /// Wrapped internal statistics for \p ordered_list
- typedef implementatin_specific bucket_stat;
-#else
+ //@cond
typedef typename ordered_list::template select_stat_wrapper< typename ordered_list::stat > bucket_stat;
-#endif
-#ifdef CDS_DOXYGEN_INVOKED
- /// Internal bucket type - rebind \p ordered_list with empty item counter and wrapped internal statistics
- typedef modified_ordered_list internal_bucket_type;
-#else
typedef typename ordered_list::template rebind_traits<
cds::opt::item_counter< cds::atomicity::empty_item_counter >
, cds::opt::stat< typename bucket_stat::wrapped_stat >
>::type internal_bucket_type;
-#endif
- /// Guarded pointer - a result of \p get() and \p extract() functions
- typedef typename internal_bucket_type::guarded_ptr guarded_ptr;
-
- //@cond
/// Bucket table allocator
typedef typename allocator::template rebind< internal_bucket_type >::other bucket_table_allocator;
+
+ typedef typename bucket_stat::stat stat;
//@endcond
+ /// Guarded pointer - a result of \p get() and \p extract() functions
+ typedef typename internal_bucket_type::guarded_ptr guarded_ptr;
+
protected:
//@cond
size_t const m_nHashBitmask;
internal_bucket_type * m_Buckets; ///< bucket table
item_counter m_ItemCounter; ///< Item counter
hash m_HashFunctor; ///< Hash functor
- typename bucket_stat::stat m_Stat; ///< Internal statistics
+ stat m_Stat; ///< Internal statistics
//@endcond
public:
size_t nMaxItemCount, ///< estimation of max item count in the hash set
size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket
) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor ))
- , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) )
+ , m_Buckets( bucket_table_allocator().allocate( bucket_count()) )
{
for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it )
construct_bucket<bucket_stat>( it );
for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it )
it->~internal_bucket_type();
- bucket_table_allocator().deallocate( m_Buckets, bucket_count() );
+ bucket_table_allocator().deallocate( m_Buckets, bucket_count());
}
/// Inserts new node
where \p val is the item inserted.
The user-defined functor is called only if the inserting is success.
- @warning For \ref cds_nonintrusive_MichaelList_gc "MichaelList" and \ref cds_nonintrusive_IterableList_gc "IterableList"
+ @warning For \ref cds_nonintrusive_MichaelList_gc "MichaelList" and \ref cds_nonintrusive_IterableList_gc "IterableList"
as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
@ref cds_nonintrusive_LazyList_gc "LazyList" provides exclusive access to inserted item and does not require any node-level
synchronization.
The operation performs inserting or changing data with lock-free manner.
If the item \p val is not found in the set, then \p val is inserted iff \p bAllowInsert is \p true.
- Otherwise, the current element is changed to \p val, the old element will be retired later
- by call \p Traits::disposer.
+ Otherwise, the current element is changed to \p val, the old element will be retired later.
Returns std::pair<bool, bool> where \p first is \p true if operation is successful,
\p second is \p true if \p val has been added or \p false if the item with that key
#ifdef CDS_DOXYGEN_INVOKED
std::pair<bool, bool>
#else
- typename std::enable_if<
+ typename std::enable_if<
std::is_same< Q, Q>::value && is_iterable_list< ordered_list >::value,
std::pair<bool, bool>
>::type
{
internal_bucket_type& b = bucket( key );
typename internal_bucket_type::iterator it = b.find( key );
- if ( it == b.end() )
+ if ( it == b.end())
return end();
return iterator( it, &b, bucket_end());
}
{
internal_bucket_type& b = bucket( key );
typename internal_bucket_type::iterator it = b.find( key );
- if ( it == b.end() )
+ if ( it == b.end())
return end();
- return iterator( it, &b, bucket_end() );
+ return iterator( it, &b, bucket_end());
}
//@endcond
{
internal_bucket_type& b = bucket( key );
typename internal_bucket_type::iterator it = b.find_with( key, pred );
- if ( it == b.end() )
+ if ( it == b.end())
return end();
- return iterator( it, &b, bucket_end() );
+ return iterator( it, &b, bucket_end());
}
//@cond
template <typename Q, typename Less>
{
internal_bucket_type& b = bucket( key );
typename internal_bucket_type::iterator it = b.find_with( key, pred );
- if ( it == b.end() )
+ if ( it == b.end())
return end();
- return iterator( it, &b, bucket_end() );
+ return iterator( it, &b, bucket_end());
}
//@endcond
const_iterator get_const_begin() const
{
- return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end() );
+ return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end());
}
const_iterator get_const_end() const
{
- return const_iterator(( bucket_end() -1 )->cend(), bucket_end() - 1, bucket_end() );
+ return const_iterator(( bucket_end() -1 )->cend(), bucket_end() - 1, bucket_end());
}
template <typename Stat>