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:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "set_type.h"
{}
key_thread()
+ : nKey()
+ , nThread()
+ , pad_( 0 )
{}
};
template <>
struct hash<set::key_thread>
{
- typedef size_t result_type;
+ typedef size_t result_type;
typedef set::key_thread argument_type;
size_t operator()( set::key_thread const& k ) const
{
return std::hash<size_t>()(k.nKey);
}
+
size_t operator()( size_t k ) const
{
return std::hash<size_t>()(k);
struct update_functor
{
template <typename Q>
- void operator()( bool /*bNew*/, key_value_pair const&, Q const& )
+ void operator()( bool /*bNew*/, key_value_pair const&, Q const& ) const
{}
- void operator()(key_value_pair& /*cur*/, key_value_pair * /*prev*/)
+ void operator()(key_value_pair& /*cur*/, key_value_pair * /*prev*/) const
{}
};
public:
std::vector<size_t>& arrData = fixture.m_arrData;
for ( size_t i = 0; i < arrData.size(); ++i ) {
- if ( rSet.insert( key_type( arrData[i], id() )))
+ if ( rSet.insert( key_type( arrData[i], id())))
++m_nInsertSuccess;
else
++m_nInsertFailed;
update_functor f;
for ( size_t i = arrData.size() - 1; i > 0; --i ) {
if ( arrData[i] & 1 )
- rSet.update( key_type( arrData[i], id() ), f, true );
+ rSet.update( key_type( arrData[i], id()), f, true );
}
fixture.m_nInsThreadCount.fetch_sub( 1, atomics::memory_order_release );
struct eraser {
static bool erase( SetType& s, size_t key, size_t /*thread*/)
{
- return s.erase_with( key, key_less() );
+ return s.erase_with( key, key_less());
}
};
}
EXPECT_EQ( nInsertSuccess, s_nSetSize * s_nInsThreadCount );
- EXPECT_EQ( nInsertFailed, 0 );
+ EXPECT_EQ( nInsertFailed, 0u );
propout()
<< std::make_pair( "insert_success", nInsertSuccess )
size_t nExtractFailed = 0;
for ( size_t i = 0; i < pool.size(); ++i ) {
cds_test::thread& thr = pool.get( i );
- switch ( thr.type() ) {
+ switch ( thr.type()) {
case inserter_thread:
{
insert_thread& inserter = static_cast<insert_thread&>( thr );
}
EXPECT_EQ( nInsertSuccess, s_nSetSize * s_nInsThreadCount );
- EXPECT_EQ( nInsertFailed, 0 );
+ EXPECT_EQ( nInsertFailed, 0u );
propout()
<< std::make_pair( "insert_success", nInsertSuccess )
check_before_clear( testSet );
testSet.clear();
- EXPECT_TRUE( testSet.empty() ) << "set.size=" << testSet.size();
+ EXPECT_TRUE( testSet.empty()) << "set.size=" << testSet.size();
additional_check( testSet );
print_stat( propout(), testSet );