public:
/// Guarded pointer
- typedef cds::gc::guarded_ptr< gc, node_type, value_type, details::guarded_ptr_cast_set<node_type, value_type> > guarded_ptr;
+ typedef typename gc::template guarded_ptr< node_type, value_type, details::guarded_ptr_cast_set<node_type, value_type> > guarded_ptr;
public:
/// Forward iterator (see \p SplitListSet::iterator)
/// Extracts the item with specified \p key
/** \anchor cds_nonintrusive_SplitListMap_hp_extract
The function searches an item with key equal to \p key,
- unlinks it from the map, and returns it in \p dest parameter.
- If the item with key equal to \p key is not found the function returns \p false.
+ unlinks it from the map, and returns it as \p guarded_ptr.
+ If \p key is not found the function returns an empty guarded pointer.
Note the compare functor should accept a parameter of type \p K that may be not the same as \p value_type.
- The extracted item is freed automatically when returned \ref guarded_ptr object will be destroyed or released.
+ The extracted item is freed automatically when returned \p guarded_ptr object will be destroyed or released.
@note Each \p guarded_ptr object uses the GC's guard that can be limited resource.
Usage:
splitlist_map theMap;
// ...
{
- splitlist_map::guarded_ptr gp;
- theMap.extract( gp, 5 );
- // Deal with gp
- // ...
-
+ splitlist_map::guarded_ptr gp(theMap.extract( 5 ));
+ if ( gp ) {
+ // Deal with gp
+ // ...
+ }
// Destructor of gp releases internal HP guard
}
\endcode
*/
template <typename K>
- bool extract( guarded_ptr& dest, K const& key )
+ guarded_ptr extract( K const& key )
{
- return base_class::extract_( dest.guard(), key );
+ guarded_ptr gp;
+ base_class::extract_( gp.guard(), key );
+ return gp;
}
/// Extracts the item using compare functor \p pred
/**
- The function is an analog of \ref cds_nonintrusive_SplitListMap_hp_extract "extract(guarded_ptr&, K const&)"
+ The function is an analog of \ref cds_nonintrusive_SplitListMap_hp_extract "extract(K const&)"
but \p pred predicate is used for key comparing.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p K
\p pred must imply the same element order as the comparator used for building the map.
*/
template <typename K, typename Less>
- bool extract_with( guarded_ptr& dest, K const& key, Less pred )
+ guarded_ptr extract_with( K const& key, Less pred )
{
CDS_UNUSED( pred );
- return base_class::extract_with_( dest.guard(), key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+ guarded_ptr gp;
+ base_class::extract_with_( gp.guard(), key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+ return gp;
}
/// Finds the key \p key
/// Finds \p key and return the item found
/** \anchor cds_nonintrusive_SplitListMap_hp_get
The function searches the item with key equal to \p key
- and assigns the item found to guarded pointer \p ptr.
- The function returns \p true if \p key is found, and \p false otherwise.
- If \p key is not found the \p ptr parameter is not changed.
+ and returns the item found as a guarded pointer.
+ If \p key is not found the function returns an empty guarded pointer.
@note Each \p guarded_ptr object uses one GC's guard which can be limited resource.
splitlist_map theMap;
// ...
{
- splitlist_map::guarded_ptr gp;
- if ( theMap.get( gp, 5 )) {
+ splitlist_map::guarded_ptr gp(theMap.get( 5 ));
+ if ( gp ) {
// Deal with gp
//...
}
should accept a parameter of type \p K that can be not the same as \p value_type.
*/
template <typename K>
- bool get( guarded_ptr& ptr, K const& key )
+ guarded_ptr get( K const& key )
{
- return base_class::get_( ptr.guard(), key );
+ guarded_ptr gp;
+ base_class::get_( gp.guard(), key );
+ return gp;
}
/// Finds \p key and return the item found
/**
- The function is an analog of \ref cds_nonintrusive_SplitListMap_hp_get "get( guarded_ptr&, K const&)"
+ The function is an analog of \ref cds_nonintrusive_SplitListMap_hp_get "get( K const&)"
but \p pred is used for comparing the keys.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p K
\p pred must imply the same element order as the comparator used for building the map.
*/
template <typename K, typename Less>
- bool get_with( guarded_ptr& ptr, K const& key, Less pred )
+ guarded_ptr get_with( K const& key, Less pred )
{
CDS_UNUSED( pred );
- return base_class::get_with_( ptr.guard(), key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+ guarded_ptr gp;
+ base_class::get_with_( gp.guard(), key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+ return gp;
}
/// Clears the map (not atomic)
public:
/// Guarded pointer
- typedef cds::gc::guarded_ptr< gc, node_type, value_type, details::guarded_ptr_cast_set<node_type, value_type> > guarded_ptr;
+ typedef typename gc::template guarded_ptr< node_type, value_type, details::guarded_ptr_cast_set<node_type, value_type> > guarded_ptr;
protected:
//@cond
/// Extracts the item with specified \p key
/** \anchor cds_nonintrusive_SplitListSet_hp_extract
The function searches an item with key equal to \p key,
- unlinks it from the set, and returns it in \p dest parameter.
- If the item with key equal to \p key is not found the function returns \p false.
+ unlinks it from the set, and returns it as \p guarded_ptr.
+ If \p key is not found the function returns an empty guarded pointer.
Note the compare functor should accept a parameter of type \p Q that may be not the same as \p value_type.
- The extracted item is freed automatically when returned \ref guarded_ptr object will be destroyed or released.
+ The extracted item is freed automatically when returned \p guarded_ptr object will be destroyed or released.
@note Each \p guarded_ptr object uses the GC's guard that can be limited resource.
Usage:
splitlist_set theSet;
// ...
{
- splitlist_set::guarded_ptr gp;
- theSet.extract( gp, 5 );
- // Deal with gp
- // ...
-
+ splitlist_set::guarded_ptr gp(theSet.extract( 5 ));
+ if ( gp ) {
+ // Deal with gp
+ // ...
+ }
// Destructor of gp releases internal HP guard
}
\endcode
*/
template <typename Q>
- bool extract( guarded_ptr& dest, Q const& key )
+ guarded_ptr extract( Q const& key )
{
- return extract_( dest.guard(), key );
+ guarded_ptr gp;
+ extract_( gp.guard(), key );
+ return gp;
}
/// Extracts the item using compare functor \p pred
/**
- The function is an analog of \ref cds_nonintrusive_SplitListSet_hp_extract "extract(guarded_ptr&, Q const&)"
+ The function is an analog of \ref cds_nonintrusive_SplitListSet_hp_extract "extract(Q const&)"
but \p pred predicate is used for key comparing.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p Q
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- bool extract_with( guarded_ptr& dest, Q const& key, Less pred )
+ guarded_ptr extract_with( Q const& key, Less pred )
{
- return extract_with_( dest.guard(), key, pred );
+ guarded_ptr gp;
+ extract_with_( gp.guard(), key, pred );
+ return gp;
}
/// Finds the key \p key
/// Finds the key \p key and return the item found
/** \anchor cds_nonintrusive_SplitListSet_hp_get
The function searches the item with key equal to \p key
- and assigns the item found to guarded pointer \p ptr.
- The function returns \p true if \p key is found, and \p false otherwise.
- If \p key is not found the \p ptr parameter is not changed.
+ and returns the item found as \p guarded_ptr.
+ If \p key is not found the function returns an empty guarded pointer.
@note Each \p guarded_ptr object uses one GC's guard which can be limited resource.
splitlist_set theSet;
// ...
{
- splitlist_set::guarded_ptr gp;
- if ( theSet.get( gp, 5 )) {
+ splitlist_set::guarded_ptr gp(theSet.get( 5 ));
+ if ( gp ) {
// Deal with gp
//...
}
should accept a parameter of type \p Q that can be not the same as \p value_type.
*/
template <typename Q>
- bool get( guarded_ptr& ptr, Q const& key )
+ guarded_ptr get( Q const& key )
{
- return get_( ptr.guard(), key );
+ guarded_ptr gp;
+ get_( gp.guard(), key );
+ return gp;
}
/// Finds \p key and return the item found
/**
- The function is an analog of \ref cds_nonintrusive_SplitListSet_hp_get "get( guarded_ptr&, Q const&)"
+ The function is an analog of \ref cds_nonintrusive_SplitListSet_hp_get "get( Q const&)"
but \p pred is used for comparing the keys.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p Q
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- bool get_with( guarded_ptr& ptr, Q const& key, Less pred )
+ guarded_ptr get_with( Q const& key, Less pred )
{
- return get_with_( ptr.guard(), key, pred );
+ guarded_ptr gp;
+ get_with_( gp.guard(), key, pred );
+ return gp;
}
/// Clears the set (not atomic)
using base_class::get_;
template <typename Q, typename Less>
- bool extract_with_( typename gc::Guard& guard, Q const& key, Less pred )
+ bool extract_with_( typename guarded_ptr::native_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 )
+ bool get_with_( typename guarded_ptr::native_guard& guard, Q const& key, Less pred )
{
CDS_UNUSED( pred );
return base_class::get_with_( guard, key, typename maker::template predicate_wrapper<Less>::type() );
//@cond
/// Initializes guarded pointer with \p p
- guarded_ptr( guarded_type * p ) CDS_NOEXCEPT
+ explicit guarded_ptr( guarded_type * p ) CDS_NOEXCEPT
{
alloc_guard();
assert( m_guard.is_initialized() );
m_guard.set( p );
}
- guarded_ptr( std::nullptr_t ) CDS_NOEXCEPT
+ explicit guarded_ptr( std::nullptr_t ) CDS_NOEXCEPT
{}
//@endcond
//@cond
/// Initializes guarded pointer with \p p
- guarded_ptr( guarded_type * p ) CDS_NOEXCEPT
+ explicit guarded_ptr( guarded_type * p ) CDS_NOEXCEPT
{
alloc_guard();
assert( m_pGuard );
m_pGuard->set(p);
}
- guarded_ptr( std::nullptr_t ) CDS_NOEXCEPT
+ explicit guarded_ptr( std::nullptr_t ) CDS_NOEXCEPT
: m_pGuard( nullptr )
{}
//@endcond
}
template <typename Q, typename Compare>
- bool extract_at( dummy_node_type * pHead, typename gc::Guard& guard, split_list::details::search_value_type<Q> const& val, Compare cmp )
+ bool extract_at( dummy_node_type * pHead, typename guarded_ptr::native_guard& guard, split_list::details::search_value_type<Q> const& val, Compare cmp )
{
assert( pHead != nullptr );
bucket_head_type h(pHead);
}
template <typename Q, typename Compare>
- bool get_at( dummy_node_type * pHead, typename gc::Guard& guard, split_list::details::search_value_type<Q> const& val, Compare cmp )
+ bool get_at( dummy_node_type * pHead, typename guarded_ptr::native_guard& guard, split_list::details::search_value_type<Q> const& val, Compare cmp )
{
assert( pHead != nullptr );
bucket_head_type h(pHead);
}
template <typename Q, typename Compare>
- bool get_( typename gc::Guard& guard, Q const& val, Compare cmp )
+ bool get_( typename guarded_ptr::native_guard& guard, Q const& val, Compare cmp )
{
size_t nHash = hash_value( val );
split_list::details::search_value_type<Q const> sv( val, split_list::regular_hash( nHash ));
}
template <typename Q>
- bool get_( typename gc::Guard& guard, Q const& key)
+ bool get_( typename guarded_ptr::native_guard& guard, Q const& key )
{
return get_( guard, key, key_comparator());
}
template <typename Q, typename Less>
- bool get_with_( typename gc::Guard& guard, Q const& key, Less )
+ bool get_with_( typename guarded_ptr::native_guard& guard, Q const& key, Less )
{
return get_( guard, key, typename wrapped_ordered_list::template make_compare_from_less<Less>());
}
}
template <typename Q, typename Compare>
- bool extract_( typename gc::Guard& guard, Q const& val, Compare cmp )
+ bool extract_( typename guarded_ptr::native_guard& guard, Q const& val, Compare cmp )
{
size_t nHash = hash_value( val );
- split_list::details::search_value_type<Q const> sv( val, split_list::regular_hash( nHash ));
+ split_list::details::search_value_type<Q const> sv( val, split_list::regular_hash( nHash ));
dummy_node_type * pHead = get_bucket( nHash );
assert( pHead != nullptr );
}
template <typename Q>
- bool extract_( typename gc::Guard& guard, Q const& key)
+ bool extract_( typename guarded_ptr::native_guard& guard, Q const& key )
{
return extract_( guard, key, key_comparator());
}
template <typename Q, typename Less>
- bool extract_with_( typename gc::Guard& guard, Q const& key, Less )
+ bool extract_with_( typename guarded_ptr::native_guard& guard, Q const& key, Less )
{
return extract_( guard, key, typename wrapped_ordered_list::template make_compare_from_less<Less>() );
}
-
//@endcond
public:
/// Extracts the item with specified \p key
/** \anchor cds_intrusive_SplitListSet_hp_extract
The function searches an item with key equal to \p key,
- unlinks it from the set, and returns it in \p dest parameter.
- If the item with key equal to \p key is not found the function returns \p false.
+ unlinks it from the set, and returns it as \p guarded_ptr.
+ If \p key is not found the function returns an empty guarded pointer.
Note the compare functor should accept a parameter of type \p Q that may be not the same as \p value_type.
- The \ref disposer specified in \p OrderedList class' template parameter is called automatically
- by garbage collector \p GC when returned \ref guarded_ptr object will be destroyed or released.
+ The \p disposer specified in \p OrderedList class' template parameter is called automatically
+ by garbage collector \p GC when returned \p guarded_ptr object will be destroyed or released.
@note Each \p guarded_ptr object uses the GC's guard that can be limited resource.
Usage:
splitlist_set theSet;
// ...
{
- splitlist_set::guarded_ptr gp;
- theSet.extract( gp, 5 );
- // Deal with gp
- // ...
-
+ splitlist_set::guarded_ptr gp( theSet.extract( 5 ));
+ if ( gp) {
+ // Deal with gp
+ // ...
+ }
// Destructor of gp releases internal HP guard
}
\endcode
*/
template <typename Q>
- bool extract( guarded_ptr& dest, Q const& key )
+ guarded_ptr extract( Q const& key )
{
- return extract_( dest.guard(), key );
+ guarded_ptr gp;
+ extract_( gp.guard(), key );
+ return gp;
}
/// Extracts the item using compare functor \p pred
/**
- The function is an analog of \ref cds_intrusive_SplitListSet_hp_extract "extract(guarded_ptr&, Q const&)"
+ The function is an analog of \ref cds_intrusive_SplitListSet_hp_extract "extract(Q const&)"
but \p pred predicate is used for key comparing.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p Q
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- bool extract_with( guarded_ptr& dest, Q const& key, Less pred )
+ guarded_ptr extract_with( Q const& key, Less pred )
{
- return extract_with_( dest.guard(), key, pred );
+ guarded_ptr gp;
+ extract_with_( gp.guard(), key, pred );
+ return gp;
}
/// Finds the key \p key
/// Finds the key \p key and return the item found
/** \anchor cds_intrusive_SplitListSet_hp_get
The function searches the item with key equal to \p key
- and assigns the item found to guarded pointer \p ptr.
- The function returns \p true if \p key is found, and \p false otherwise.
- If \p key is not found the \p ptr parameter is not changed.
+ and returns the item found as \p guarded_ptr.
+ If \p key is not found the function returns an empty guarded pointer.
- The \ref disposer specified in \p OrderedList class' template parameter is called
- by garbage collector \p GC automatically when returned \ref guarded_ptr object
+ The \p disposer specified in \p OrderedList class' template parameter is called
+ by garbage collector \p GC automatically when returned \p guarded_ptr object
will be destroyed or released.
@note Each \p guarded_ptr object uses one GC's guard which can be limited resource.
splitlist_set theSet;
// ...
{
- splitlist_set::guarded_ptr gp;
- if ( theSet.get( gp, 5 )) {
+ splitlist_set::guarded_ptr gp = theSet.get( 5 );
+ if ( gp ) {
// Deal with gp
//...
}
should accept a parameter of type \p Q that can be not the same as \p value_type.
*/
template <typename Q>
- bool get( guarded_ptr& ptr, Q const& key )
+ guarded_ptr get( Q const& key )
{
- return get_( ptr.guard(), key );
+ guarded_ptr gp;
+ get_( gp.guard(), key );
+ return gp;
}
/// Finds the key \p key and return the item found
/**
- The function is an analog of \ref cds_intrusive_SplitListSet_hp_get "get( guarded_ptr& ptr, Q const&)"
+ The function is an analog of \ref cds_intrusive_SplitListSet_hp_get "get( Q const&)"
but \p pred is used for comparing the keys.
\p Less functor has the semantics like \p std::less but should take arguments of type \ref value_type and \p Q
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- bool get_with( guarded_ptr& ptr, Q const& key, Less pred )
+ guarded_ptr get_with( Q const& key, Less pred )
{
- return get_with_( ptr.guard(), key, pred );
+ guarded_ptr gp;
+ get_with_( gp.guard(), key, pred );
+ return gp;
}
/// Returns item count in the set
for ( int i = 0; i < nLimit; ++i ) {
int nKey = arrRandom[i];
- CPPUNIT_ASSERT( m.get(gp, nKey ));
+ gp = m.get( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->first == nKey );
CPPUNIT_CHECK( gp->second.m_val == nKey );
- CPPUNIT_ASSERT( m.extract(gp, nKey));
+ gp = m.extract( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->first == nKey );
CPPUNIT_CHECK( gp->second.m_val == nKey );
- CPPUNIT_CHECK( !m.get(gp, nKey));
- gp.release();
+ gp = m.get( nKey );
+ CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( !m.extract(gp, nKey));
+ CPPUNIT_CHECK( !m.extract(nKey));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( m.empty() );
for ( int i = 0; i < nLimit; ++i ) {
int nKey = arrRandom[i];
- CPPUNIT_ASSERT( m.get_with(gp, other_item(nKey), other_less() ));
+ gp = m.get_with( other_item( nKey ), other_less() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->first == nKey );
CPPUNIT_CHECK( gp->second.m_val == nKey );
- CPPUNIT_ASSERT( m.extract_with(gp, other_item(nKey), other_less() ));
+ gp = m.extract_with( other_item( nKey ), other_less() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->first == nKey );
CPPUNIT_CHECK( gp->second.m_val == nKey );
- CPPUNIT_CHECK( !m.get_with(gp, other_item(nKey), other_less() ));
- gp.release();
+ gp = m.get_with( other_item( nKey ), other_less() );
+ CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( !m.extract_with(gp, other_item(nKey), other_less() ));
+ CPPUNIT_CHECK( !m.extract_with(other_item(nKey), other_less() ));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( m.empty() );
guarded_ptr gp;
for ( size_t i = 0; i < nLimit; i += 2 ) {
int nKey = arr[i];
- CPPUNIT_ASSERT( s.get( gp, nKey ));
+ gp = s.get( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- CPPUNIT_ASSERT( s.extract( gp, nKey ));
+ gp = s.extract( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty() );
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
- CPPUNIT_CHECK( !s.get( gp, nKey ));
+ gp = s.get( nKey );
+ CPPUNIT_CHECK( !gp );
CPPUNIT_ASSERT( gp.empty() );
- CPPUNIT_CHECK( !s.extract( gp, nKey ));
+ CPPUNIT_CHECK( !s.extract( nKey ));
CPPUNIT_CHECK( gp.empty() );
nKey = arr[i+1];
- CPPUNIT_ASSERT( s.get_with( gp, nKey, less<value_type>() ));
+ gp = s.get_with( nKey, less<value_type>() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- CPPUNIT_ASSERT( s.extract_with( gp, nKey, less<value_type>() ));
+ gp = s.extract_with( nKey, less<value_type>() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty() );
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
- CPPUNIT_CHECK( !s.get_with( gp, nKey, less<value_type>() ));
+ gp = s.get_with( nKey, less<value_type>() );
+ CPPUNIT_CHECK( !gp );
CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !s.extract_with( gp, nKey, less<value_type>() ));
+ CPPUNIT_CHECK( !s.extract_with( nKey, less<value_type>() ));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_CHECK( s.empty() );
CPPUNIT_CHECK( check_size( s, 0 ));
- CPPUNIT_CHECK( !s.get( gp, 100 ));
- CPPUNIT_CHECK( !s.extract( gp, 100 ));
+ CPPUNIT_CHECK( !s.get( 100 ));
+ CPPUNIT_CHECK( !s.extract( 100 ));
CPPUNIT_CHECK( gp.empty() );
Set::gc::force_dispose();
for ( int i = 0; i < nLimit; ++i ) {
int nKey = arrRandom[i];
- CPPUNIT_ASSERT( s.get(gp, nKey ));
+ gp = s.get( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey );
- CPPUNIT_ASSERT( s.extract(gp, nKey));
+ gp = s.extract( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey );
- CPPUNIT_CHECK( !s.get(gp, nKey));
- gp.release();
+ CPPUNIT_CHECK( !s.get(nKey));
- CPPUNIT_CHECK( !s.extract(gp, nKey));
+ gp = s.extract( nKey );
+ CPPUNIT_CHECK( !gp );
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( s.empty() );
for ( int i = 0; i < nLimit; ++i ) {
int nKey = arrRandom[i];
- CPPUNIT_ASSERT( s.get_with(gp, other_item(nKey), other_less() ));
+ gp = s.get_with( other_item( nKey ), other_less() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey );
- CPPUNIT_ASSERT( s.extract_with(gp, other_item(nKey), other_less() ));
+ gp = s.extract_with( other_item( nKey ), other_less() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey );
- CPPUNIT_CHECK( !s.get_with(gp, other_item(nKey), other_less() ));
- gp.release();
+ gp = s.get_with( other_item( nKey ), other_less() );
+ CPPUNIT_CHECK( !gp );
- CPPUNIT_CHECK( !s.extract_with(gp, other_item(nKey), other_less() ));
+ CPPUNIT_CHECK( !s.extract_with(other_item(nKey), other_less() ));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( s.empty() );