From e8e37cdd845f3adccf87210faa18c83bd1804eb8 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 2 Nov 2014 17:41:27 +0300 Subject: [PATCH] Remove old VC++ stdext::hash_map from tests --- tests/unit/map2/std_hash_map.h | 14 ---- tests/unit/map2/std_hash_map_gcc.h | 2 +- tests/unit/map2/std_hash_map_vc.h | 88 -------------------- tests/unit/map2/{std_map_gcc.h => std_map.h} | 15 ++-- 4 files changed, 8 insertions(+), 111 deletions(-) delete mode 100644 tests/unit/map2/std_hash_map.h delete mode 100644 tests/unit/map2/std_hash_map_vc.h rename tests/unit/map2/{std_map_gcc.h => std_map.h} (89%) diff --git a/tests/unit/map2/std_hash_map.h b/tests/unit/map2/std_hash_map.h deleted file mode 100644 index f0e18558..00000000 --- a/tests/unit/map2/std_hash_map.h +++ /dev/null @@ -1,14 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDSUNIT_STD_HASH_MAP_H -#define __CDSUNIT_STD_HASH_MAP_H - -#if CDS_COMPILER == CDS_COMPILER_MSVC -# include "map2/std_hash_map_vc.h" -#elif CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG -# include "map2/std_hash_map_gcc.h" -#else -# error "unordered_map is undefined for this compiler" -#endif - -#endif // #ifndef __CDSUNIT_STD_HASH_MAP_H diff --git a/tests/unit/map2/std_hash_map_gcc.h b/tests/unit/map2/std_hash_map_gcc.h index 5cb7ac81..e3984b74 100644 --- a/tests/unit/map2/std_hash_map_gcc.h +++ b/tests/unit/map2/std_hash_map_gcc.h @@ -5,7 +5,7 @@ #include //unique_lock #include -#include // ref +//#include // ref namespace map2 { diff --git a/tests/unit/map2/std_hash_map_vc.h b/tests/unit/map2/std_hash_map_vc.h deleted file mode 100644 index 9acb49aa..00000000 --- a/tests/unit/map2/std_hash_map_vc.h +++ /dev/null @@ -1,88 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDSUNIT_STD_HASH_MAP_VC_H -#define __CDSUNIT_STD_HASH_MAP_VC_H - -#include -#include // ref -#include //unique_lock - -namespace map2 { - template - class StdHashMap: public stdext::hash_map >, Alloc> - { - public: - Lock m_lock; - typedef std::unique_lock AutoLock; - typedef stdext::hash_map >, Alloc> base_class; - public: - typedef typename base_class::mapped_type value_type; - typedef typename base_class::value_type pair_type; - typedef size_t item_counter; - - StdHashMap( size_t nMapSize, size_t nLoadFactor ) - {} - - bool find( const Key& key ) - { - AutoLock al( m_lock ); - return base_class::find( key ) != base_class::end(); - } - - bool insert( const Key& key, const Value& val ) - { - AutoLock al( m_lock ); - return base_class::insert( base_class::value_type(key, val)).second; - } - - template - bool insert( const Key& key, const T& val, Func func ) - { - AutoLock al( m_lock ); - std::pair pRet = base_class::insert( base_class::value_type(key, Value() )); - if ( pRet.second ) { - func( pRet.first->second, val ); - return true; - } - return false; - } - - template - std::pair ensure( const T& key, Func func ) - { - AutoLock al( m_lock ); - std::pair pRet = base_class::insert( base_class::value_type(key, Value() )); - if ( pRet.second ) { - func( true, *pRet.first ); - return std::make_pair( true, true ); - } - else { - func( false, *pRet.first ); - return std::make_pair( true, false ); - } - } - - bool erase( const Key& key ) - { - AutoLock al( m_lock ); - return base_class::erase( 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( key ) != 0; - } - return false; - } - - - std::ostream& dump( std::ostream& stm ) { return stm; } - }; -} // namespace map2 - -#endif // #ifndef __CDSUNIT_STD_HASH_MAP_VC_H diff --git a/tests/unit/map2/std_map_gcc.h b/tests/unit/map2/std_map.h similarity index 89% rename from tests/unit/map2/std_map_gcc.h rename to tests/unit/map2/std_map.h index c798c9cc..28517449 100644 --- a/tests/unit/map2/std_map_gcc.h +++ b/tests/unit/map2/std_map.h @@ -4,7 +4,6 @@ #define __CDSUNIT_STD_MAP_GCC_H #include -#include // ref #include //unique_lock namespace map2 { @@ -15,7 +14,7 @@ namespace map2 { class StdMap: public std::map, Alloc> { Lock m_lock; - typedef std::unique_lock AutoLock; + typedef std::unique_lock scoped_lock; typedef std::map, Alloc> base_class; public: typedef typename base_class::mapped_type value_type; @@ -27,20 +26,20 @@ namespace map2 { bool find( const Key& key ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); return base_class::find( key ) != base_class::end(); } bool insert( const Key& key, const Value& val ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); return base_class::insert( typename base_class::value_type(key, val)).second; } template bool insert( const Key& key, const T& val, Func func ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); std::pair pRet = base_class::insert( typename base_class::value_type(key, Value() )); if ( pRet.second ) { func( pRet.first->second, val ); @@ -52,7 +51,7 @@ namespace map2 { template std::pair ensure( const T& key, Func func ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); std::pair pRet = base_class::insert( typename base_class::value_type(key, Value() )); if ( pRet.second ) { func( true, *pRet.first ); @@ -66,14 +65,14 @@ namespace map2 { bool erase( const Key& key ) { - AutoLock al( m_lock ); + scoped_lock al( m_lock ); return base_class::erase( 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( key ); if ( it != base_class::end() ) { func( (*it) ); -- 2.34.1