\par Usage
You should decide what garbage collector you want, and what ordered list you want to use as a base. Split-ordered list
- is original data structure based on an ordered list.
+ is original data structure based on an ordered list.
Suppose, you want construct split-list set based on \p gc::DHP GC
and \p LazyList as ordered list implementation. So, you beginning your program with following include:
Now you are ready to declare our set class based on \p %SplitListSet:
\code
- typedef cc::SplitListSet< cds::gc::PTB, foo, foo_set_traits > foo_set;
+ typedef cc::SplitListSet< cds::gc::DHP, foo, foo_set_traits > foo_set;
\endcode
You may use the modern option-based declaration instead of classic traits-based one:
\code
typedef cc:SplitListSet<
- cs::gc::PTB // GC used
+ cs::gc::DHP // GC used
,foo // type of data stored
,cc::split_list::make_traits< // metafunction to build split-list traits
cc::split_list::ordered_list<cc::lazy_list_tag> // tag for underlying ordered list implementation
/// Hash functor for \p %value_type and all its derivatives that you use
typedef typename base_class::hash hash;
typedef typename base_class::item_counter item_counter; ///< Item counter type
+ typedef typename base_class::stat stat; ///< Internal statistics
protected:
//@cond
template <typename Q, typename Less, typename Func>
bool find_with_( Q& val, Less pred, Func f )
{
+ CDS_UNUSED( pred );
return base_class::find_with( val, typename maker::template predicate_wrapper<Less>::type(),
[&f]( node_type& item, Q& val ) { f(item.m_Value, val) ; } );
}
/// Returns a forward const iterator addressing the first element in a set
const_iterator begin() const
{
- return const_iterator( base_class::begin() );
+ return cbegin();
+ }
+ /// Returns a forward const iterator addressing the first element in a set
+ const_iterator cbegin() const
+ {
+ return const_iterator( base_class::cbegin() );
}
/// Returns an const iterator that addresses the location succeeding the last element in a set
const_iterator end() const
{
- return const_iterator( base_class::end() );
+ return cend();
+ }
+ /// Returns an const iterator that addresses the location succeeding the last element in a set
+ const_iterator cend() const
+ {
+ return const_iterator( base_class::cend() );
}
public:
template <typename Q, typename Less>
bool erase_with( Q const& key, Less pred )
{
+ CDS_UNUSED( pred );
return base_class::erase_with( key, typename maker::template predicate_wrapper<Less>::type() );
}
template <typename Q, typename Less, typename Func>
bool erase_with( Q const& key, Less pred, Func f )
{
+ CDS_UNUSED( pred );
return base_class::erase_with( key, typename maker::template predicate_wrapper<Less>::type(),
[&f](node_type& node) { f( node.m_Value ); } );
}
\endcode
where \p item is the item found, \p key is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using \p std::ref.
-
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
The functor does not serialize simultaneous access to the set's \p item. If such access is
{
return find_( key, f );
}
+ //@cond
+ template <typename Q, typename Func>
+ bool find( Q const& key, Func f )
+ {
+ return find_( key, f );
+ }
+ //@endcond
/// Finds the key \p key using \p pred predicate for searching
/**
{
return find_with_( key, pred, f );
}
+ //@cond
+ template <typename Q, typename Less, typename Func>
+ bool find_with( Q const& key, Less pred, Func f )
+ {
+ return find_with_( key, pred, f );
+ }
+ //@endcond
/// Finds the key \p key
/** \anchor cds_nonintrusive_SplitListSet_find_val
template <typename Q, typename Less>
bool find_with( Q const& key, Less pred )
{
+ CDS_UNUSED( pred );
return base_class::find_with( key, typename maker::template predicate_wrapper<Less>::type() );
}
return base_class::size();
}
+ /// Returns internal statistics
+ stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+
protected:
//@cond
using base_class::extract_;
template <typename Q, typename Less>
bool extract_with_( typename gc::Guard& guard, Q const& key, Less pred )
{
+ CDS_UNUSED( pred );
return base_class::extract_with_( guard, key, typename maker::template predicate_wrapper<Less>::type() );
}
template <typename Q, typename Less>
bool get_with_( typename gc::Guard& guard, Q const& key, Less pred )
{
+ CDS_UNUSED( pred );
return base_class::get_with_( guard, key, typename maker::template predicate_wrapper<Less>::type() );
}