From 21a12499246b2da2d1c1344bb3551d10451f031c Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 2 Nov 2014 17:48:43 +0300 Subject: [PATCH] Remove old MSVC++ stdext::hash_set from tests --- tests/unit/set2/std_hash_set.h | 12 ---- tests/unit/set2/std_hash_set_std.h | 14 ++-- tests/unit/set2/std_hash_set_vc9.h | 106 ----------------------------- 3 files changed, 7 insertions(+), 125 deletions(-) delete mode 100644 tests/unit/set2/std_hash_set.h delete mode 100644 tests/unit/set2/std_hash_set_vc9.h diff --git a/tests/unit/set2/std_hash_set.h b/tests/unit/set2/std_hash_set.h deleted file mode 100644 index 4b89ca0e..00000000 --- a/tests/unit/set2/std_hash_set.h +++ /dev/null @@ -1,12 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDSUNIT_STD_HASH_SET_H -#define __CDSUNIT_STD_HASH_SET_H - -#if (CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER == 1500 -# include "set2/std_hash_set_vc9.h" -#else -# include "set2/std_hash_set_std.h" -#endif - -#endif // #ifndef __CDSUNIT_STD_HASH_SET_H diff --git a/tests/unit/set2/std_hash_set_std.h b/tests/unit/set2/std_hash_set_std.h index 55845ce9..611e76b0 100644 --- a/tests/unit/set2/std_hash_set_std.h +++ b/tests/unit/set2/std_hash_set_std.h @@ -22,7 +22,7 @@ namespace set2 { { public: Lock m_lock; - typedef std::unique_lock AutoLock; + typedef std::unique_lock scoped_lock; typedef std::unordered_set< Value , Hash @@ -38,14 +38,14 @@ namespace set2 { template bool find( const Key& key ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); return base_class::find( value_type(key) ) != base_class::end(); } template bool insert( Key const& key ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); std::pair pRet = base_class::insert( value_type( key )); return pRet.second; } @@ -53,7 +53,7 @@ namespace set2 { template bool insert( Key const& key, Func func ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); std::pair pRet = base_class::insert( value_type( key )); if ( pRet.second ) { func( *pRet.first ); @@ -65,7 +65,7 @@ namespace set2 { template std::pair ensure( const T& key, Func func ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); std::pair pRet = base_class::insert( value_type( key )); if ( pRet.second ) { func( true, *pRet.first, key ); @@ -80,14 +80,14 @@ namespace set2 { template bool erase( const Key& key ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); return base_class::erase( value_type(key) ) != 0; } template bool erase( const T& key, Func func ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); typename base_class::iterator it = base_class::find( value_type(key) ); if ( it != base_class::end() ) { func( *it ); diff --git a/tests/unit/set2/std_hash_set_vc9.h b/tests/unit/set2/std_hash_set_vc9.h deleted file mode 100644 index 64ed6977..00000000 --- a/tests/unit/set2/std_hash_set_vc9.h +++ /dev/null @@ -1,106 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDSUNIT_STD_HASH_SET_VC_H -#define __CDSUNIT_STD_HASH_SET_VC_H - -#include -#include //unique_lock - -namespace set2 { - - template - struct hash_less: public stdext::hash_compare< KeyVal, Less > - { - typedef stdext::hash_compare< KeyVal, Less> base_class; - size_t operator()(const KeyVal& kv) const - { - return Hash()(kv); - } - - bool operator()(const KeyVal& kv1, const KeyVal& kv2) const - { - return base_class::operator()( kv1, kv2 ); - } - }; - - template - class StdHashSet: public stdext::hash_set, Alloc> - { - public: - Lock m_lock; - typedef std::unique_lock AutoLock; - typedef stdext::hash_set, Alloc> base_class; - - public: - typedef typename base_class::value_type pair_type; - - StdHashSet( size_t nSetSize, size_t nLoadFactor ) - {} - - template - bool find( const Key& key ) - { - AutoLock al( m_lock ); - return base_class::find( value_type(key) ) != base_class::end(); - } - - template - bool insert( Key const& key ) - { - AutoLock al( m_lock ); - std::pair pRet = base_class::insert( value_type( key )); - return pRet.second; - } - - template - bool insert( Key const& key, Func func ) - { - AutoLock al( m_lock ); - std::pair pRet = base_class::insert( value_type( key )); - if ( pRet.second ) { - func( *pRet.first ); - return true; - } - return false; - } - - template - std::pair ensure( const T& key, Func func ) - { - AutoLock al( m_lock ); - std::pair pRet = base_class::insert( value_type( key )); - if ( pRet.second ) { - func( true, *pRet.first, key ); - return std::make_pair( true, true ); - } - else { - func( false, *pRet.first, key ); - return std::make_pair( true, false ); - } - } - - template - bool erase( const Key& key ) - { - AutoLock al( m_lock ); - return base_class::erase( value_type(key) ) != 0; - } - - template - bool erase( const T& key, Func func ) - { - AutoLock al( m_lock ); - base_class::iterator it = base_class::find( key ); - if ( it != base_class::end() ) { - func( *it ); - return base_class::erase( it ) != base_class::end(); - } - return false; - } - - - std::ostream& dump( std::ostream& stm ) { return stm; } - }; -} // namespace set2 - -#endif // #ifndef __CDSUNIT_STD_HASH_SET_VC_H -- 2.34.1