--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="DebugVLD|Win32">\r
+ <Configuration>DebugVLD</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="DebugVLD|x64">\r
+ <Configuration>DebugVLD</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Debug|Win32">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|Win32">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Debug|x64">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|x64">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\test\unit\main.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\striped-set\intrusive_cuckoo_set.cpp">\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\test\unit\striped-set\test_intrusive_set.h" />\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{648021D3-6E18-4B94-88B8-F6A59609E210}</ProjectGuid>\r
+ <Keyword>Win32Proj</Keyword>\r
+ <RootNamespace>striped-set</RootNamespace>\r
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Label="Shared">\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <LinkIncremental>false</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <LinkIncremental>false</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtest.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtest.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ 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:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ 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.
+*/
+
+#include "test_intrusive_set.h"
+
+#include <cds/intrusive/cuckoo_set.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+
+ class IntrusiveCuckooSet : public cds_test::intrusive_set
+ {
+ protected:
+ typedef cds_test::intrusive_set base_class;
+
+ typedef base_class::hash_int hash1;
+
+ struct hash2: private hash1
+ {
+ typedef hash1 base_class;
+
+ size_t operator()( int i ) const
+ {
+ size_t h = ~(base_class::operator()( i ));
+ return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
+ }
+ template <typename Item>
+ size_t operator()( const Item& i ) const
+ {
+ size_t h = ~(base_class::operator()( i ));
+ return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
+ }
+ };
+
+ struct disposer2
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->nEraseCount;
+ }
+ };
+
+ template <typename Set>
+ void test( Set& s )
+ {
+ // Precondition: set is empty
+ // Postcondition: set is empty
+
+ base_class::test_< Set::c_isSorted>( s );
+
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+
+ typedef typename Set::value_type value_type;
+
+ std::vector< value_type > data;
+ std::vector< size_t> indices;
+ data.reserve( kSize );
+ indices.reserve( kSize );
+ size_t const nSetSize = kSize;
+ for ( size_t key = 0; key < kSize; ++key ) {
+ data.push_back( value_type( static_cast<int>(key) ) );
+ indices.push_back( key );
+ }
+ shuffle( indices.begin(), indices.end() );
+
+ // clear_and_dispose
+ for ( auto& i : data ) {
+ i.clear_stat();
+ ASSERT_TRUE( s.insert( i ) );
+ }
+ ASSERT_FALSE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
+
+ s.clear_and_dispose( disposer2());
+
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+ for ( auto& i : data ) {
+ EXPECT_EQ( i.nDisposeCount, 0 );
+ EXPECT_EQ( i.nEraseCount, 1 );
+ }
+
+ }
+
+ //void SetUp()
+ //{}
+
+ //void TearDown()
+ //{}
+ };
+
+
+//************************************************************
+// striped base hook
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_unordered )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_unordered )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::base_hook< ci::cuckoo::probeset_type< item_type::probeset_type >> hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_cmp )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s( 32, 6, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_cmp )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_less )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 4, ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_less )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_cmpmix )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_cmpmix )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_stat )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_stat )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_unordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_unordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > >
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > >
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+//************************************************************
+// striped member hook
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_unordered )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember )> hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_unordered )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ), ci::cuckoo::probeset_type< item_type::member_type::probeset_type >> hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_cmp )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s( 32, 6, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_cmp )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_less )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 4, ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_less )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_cmpmix )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_cmpmix )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_stat )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_stat )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_unordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_unordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > >
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > >
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+//************************************************************
+// refinable base hook
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_unordered )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_unordered )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef ci::cuckoo::base_hook< ci::cuckoo::probeset_type< item_type::probeset_type >> hook;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_cmp )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s( 32, 6, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_cmp )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_less )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 4, ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_less )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_cmpmix )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_cmpmix )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_stat )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_stat )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_unordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_unordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_storehash )
+ {
+ typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::base_hook<
+ ci::cuckoo::probeset_type< item_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::hash_array_size >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+//************************************************************
+// refinable member hook
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_unordered )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember )> hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_unordered )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ), ci::cuckoo::probeset_type< item_type::member_type::probeset_type >> hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_cmp )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s( 32, 6, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_cmp )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_less )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 4, ht );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_less )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_cmpmix )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_cmpmix )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_stat )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_stat )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,ci::opt::hash< std::tuple< hash1, hash2 > >
+ ,ci::opt::less< less<item_type> >
+ ,ci::opt::compare< cmp<item_type> >
+ ,ci::opt::stat< ci::cuckoo::stat >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_unordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s;
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_unordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
+ struct set_traits: public ci::cuckoo::traits
+ {
+ typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > hook;
+ typedef ci::cuckoo::refinable<> mutex_policy;
+ typedef cds::opt::hash_tuple< hash1, hash2 > hash;
+ typedef base_class::equal_to<item_type> equal_to;
+ typedef mock_disposer disposer;
+ typedef ci::cuckoo::stat stat;
+ };
+ typedef ci::CuckooSet< item_type, set_traits > set_type;
+
+ set_type s( 32, 4 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( 32, 6, 0, std::move( ht ));
+ test( s );
+ }
+
+ TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_storehash )
+ {
+ typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
+
+ typedef ci::CuckooSet< item_type
+ ,ci::cuckoo::make_traits<
+ ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
+ ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
+ ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
+ > >
+ ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
+ ,cds::opt::hash< std::tuple< hash1, hash2 > >
+ ,cds::opt::less< less<item_type> >
+ ,cds::opt::compare< cmp<item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > set_type;
+
+ typename set_type::hash_tuple_type ht;
+ set_type s( std::move( ht ));
+ test( s );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ 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:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ 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.
+*/
+
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_SET_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+#include <cds/opt/hash.h>
+
+// forward declaration
+namespace cds { namespace intrusive {}}
+
+namespace cds_test {
+
+ namespace ci = cds::intrusive;
+ namespace co = cds::opt;
+
+ class intrusive_set: public fixture
+ {
+ public:
+ static size_t const kSize = 1000;
+
+ struct stat
+ {
+ unsigned int nDisposeCount ; // count of disposer calling
+ unsigned int nFindCount ; // count of find-functor calling
+ unsigned int nUpdateNewCount;
+ unsigned int nUpdateCount;
+ mutable unsigned int nEraseCount;
+
+ stat()
+ {
+ clear_stat();
+ }
+
+ void clear_stat()
+ {
+ memset( this, 0, sizeof( *this ) );
+ }
+ };
+
+ template <typename Node>
+ struct base_int_item
+ : public Node
+ , public stat
+
+ {
+ int nKey;
+ int nVal;
+
+ base_int_item()
+ {}
+
+ explicit base_int_item( int key )
+ : nKey( key )
+ , nVal( key )
+ {}
+
+ base_int_item(int key, int val)
+ : nKey( key )
+ , nVal(val)
+ {}
+
+ base_int_item( base_int_item const& v )
+ : Node()
+ , stat()
+ , nKey( v.nKey )
+ , nVal( v.nVal )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ template <typename Node>
+ struct member_int_item: public stat
+ {
+ typedef Node member_type;
+
+ int nKey;
+ int nVal;
+
+ Node hMember;
+
+ stat s;
+
+ member_int_item()
+ {}
+
+ explicit member_int_item( int key )
+ : nKey( key )
+ , nVal( key )
+ {}
+
+ member_int_item(int key, int val)
+ : nKey( key )
+ , nVal(val)
+ {}
+
+ member_int_item(member_int_item const& v )
+ : stat()
+ , nKey( v.nKey )
+ , nVal( v.nVal )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ struct hash_int {
+ size_t operator()( int i ) const
+ {
+ return co::v::hash<int>()( i );
+ }
+ template <typename Item>
+ size_t operator()( const Item& i ) const
+ {
+ return (*this)( i.key() );
+ }
+ };
+
+ struct simple_item_counter {
+ size_t m_nCount;
+
+ simple_item_counter()
+ : m_nCount(0)
+ {}
+
+ size_t operator ++()
+ {
+ return ++m_nCount;
+ }
+
+ size_t operator --()
+ {
+ return --m_nCount;
+ }
+
+ void reset()
+ {
+ m_nCount = 0;
+ }
+
+ operator size_t() const
+ {
+ return m_nCount;
+ }
+ };
+
+
+ template <typename T>
+ struct less
+ {
+ bool operator ()(const T& v1, const T& v2 ) const
+ {
+ return v1.key() < v2.key();
+ }
+
+ template <typename Q>
+ bool operator ()(const T& v1, const Q& v2 ) const
+ {
+ return v1.key() < v2;
+ }
+
+ template <typename Q>
+ bool operator ()(const Q& v1, const T& v2 ) const
+ {
+ return v1 < v2.key();
+ }
+ };
+
+ template <typename T>
+ struct cmp {
+ int operator ()(const T& v1, const T& v2 ) const
+ {
+ if ( v1.key() < v2.key() )
+ return -1;
+ return v1.key() > v2.key() ? 1 : 0;
+ }
+
+ template <typename Q>
+ int operator ()(const T& v1, const Q& v2 ) const
+ {
+ if ( v1.key() < v2 )
+ return -1;
+ return v1.key() > v2 ? 1 : 0;
+ }
+
+ template <typename Q>
+ int operator ()(const Q& v1, const T& v2 ) const
+ {
+ if ( v1 < v2.key() )
+ return -1;
+ return v1 > v2.key() ? 1 : 0;
+ }
+ };
+
+ template <typename T>
+ struct equal_to {
+ int operator ()( const T& v1, const T& v2 ) const
+ {
+ return v1.key() == v2.key();
+ }
+
+ template <typename Q>
+ int operator ()( const T& v1, const Q& v2 ) const
+ {
+ return v1.key() == v2;
+ }
+
+ template <typename Q>
+ int operator ()( const Q& v1, const T& v2 ) const
+ {
+ return v1 == v2.key();
+ }
+ };
+
+ struct other_item {
+ int nKey;
+
+ explicit other_item( int k )
+ : nKey( k )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ struct other_less {
+ template <typename Q, typename T>
+ bool operator()( Q const& lhs, T const& rhs ) const
+ {
+ return lhs.key() < rhs.key();
+ }
+ };
+
+ struct other_equal_to {
+ template <typename Q, typename T>
+ bool operator()( Q const& lhs, T const& rhs ) const
+ {
+ return lhs.key() == rhs.key();
+ }
+ };
+
+ struct mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->nDisposeCount;
+ }
+ };
+
+ protected:
+ template <typename Set>
+ void test( Set& s )
+ {
+ test_< true >( s );
+ }
+
+ template <bool Sorted, class Set>
+ void test_( Set& s )
+ {
+ // Precondition: set is empty
+ // Postcondition: set is empty
+
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+
+ typedef typename Set::value_type value_type;
+ typedef typename std::conditional< Sorted, other_less, other_equal_to >::type other_predicate;
+ size_t const nSetSize = kSize;
+
+ std::vector< value_type > data;
+ std::vector< size_t> indices;
+ data.reserve( kSize );
+ indices.reserve( kSize );
+ for ( size_t key = 0; key < kSize; ++key ) {
+ data.push_back( value_type( static_cast<int>( key )));
+ indices.push_back( key );
+ }
+ shuffle( indices.begin(), indices.end() );
+
+ // insert/find
+ for ( auto idx : indices ) {
+ auto& i = data[ idx ];
+
+ ASSERT_FALSE( s.contains( i.nKey ));
+ ASSERT_FALSE( s.contains( i ));
+ ASSERT_FALSE( s.contains( other_item( i.key()), other_predicate()));
+ ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ));
+ ASSERT_FALSE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} ));
+
+ std::pair<bool, bool> updResult;
+
+ updResult = s.update( i, []( bool bNew, value_type&, value_type& )
+ {
+ ASSERT_TRUE( false );
+ }, false );
+ EXPECT_FALSE( updResult.first );
+ EXPECT_FALSE( updResult.second );
+
+ switch ( i.key() % 3 ) {
+ case 0:
+ ASSERT_TRUE( s.insert( i ));
+ ASSERT_FALSE( s.insert( i ));
+ updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg)
+ {
+ EXPECT_FALSE( bNew );
+ EXPECT_EQ( &val, &arg );
+ }, false );
+ EXPECT_TRUE( updResult.first );
+ EXPECT_FALSE( updResult.second );
+ break;
+ case 1:
+ EXPECT_EQ( i.nUpdateNewCount, 0 );
+ ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ));
+ EXPECT_EQ( i.nUpdateNewCount, 1 );
+ ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) );
+ EXPECT_EQ( i.nUpdateNewCount, 1 );
+ i.nUpdateNewCount = 0;
+ break;
+ case 2:
+ updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg )
+ {
+ EXPECT_TRUE( bNew );
+ EXPECT_EQ( &val, &arg );
+ });
+ EXPECT_TRUE( updResult.first );
+ EXPECT_TRUE( updResult.second );
+ break;
+ }
+
+ ASSERT_TRUE( s.contains( i.nKey ) );
+ ASSERT_TRUE( s.contains( i ) );
+ ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate()));
+ EXPECT_EQ( i.nFindCount, 0 );
+ ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ));
+ EXPECT_EQ( i.nFindCount, 1 );
+ ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ));
+ EXPECT_EQ( i.nFindCount, 2 );
+ }
+ ASSERT_FALSE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
+
+ std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); });
+
+ // erase
+ shuffle( indices.begin(), indices.end() );
+ for ( auto idx : indices ) {
+ auto& i = data[ idx ];
+
+ ASSERT_TRUE( s.contains( i.nKey ) );
+ ASSERT_TRUE( s.contains( i ) );
+ ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate() ) );
+ EXPECT_EQ( i.nFindCount, 0 );
+ ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) );
+ EXPECT_EQ( i.nFindCount, 1 );
+ ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) );
+ EXPECT_EQ( i.nFindCount, 2 );
+
+ value_type v( i );
+ switch ( i.key() % 6 ) {
+ case 0:
+ ASSERT_FALSE( s.unlink( v ));
+ ASSERT_TRUE( s.unlink( i ));
+ ASSERT_FALSE( s.unlink( i ) );
+ break;
+ case 1:
+ ASSERT_TRUE( s.erase( i.key()));
+ ASSERT_FALSE( s.erase( i.key() ) );
+ break;
+ case 2:
+ ASSERT_TRUE( s.erase( v ));
+ ASSERT_FALSE( s.erase( v ) );
+ break;
+ case 3:
+ ASSERT_TRUE( s.erase_with( other_item( i.key()), other_predicate()));
+ ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_predicate() ) );
+ break;
+ case 4:
+ EXPECT_EQ( i.nEraseCount, 0 );
+ ASSERT_TRUE( s.erase( v, []( value_type& val ) { ++val.nEraseCount; } ));
+ EXPECT_EQ( i.nEraseCount, 1 );
+ ASSERT_FALSE( s.erase( v, []( value_type& val ) { ++val.nEraseCount; } ));
+ EXPECT_EQ( i.nEraseCount, 1 );
+ break;
+ case 5:
+ EXPECT_EQ( i.nEraseCount, 0 );
+ ASSERT_TRUE( s.erase_with( other_item( i.key() ), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } ));
+ EXPECT_EQ( i.nEraseCount, 1 );
+ ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } ));
+ EXPECT_EQ( i.nEraseCount, 1 );
+ break;
+ }
+
+ ASSERT_FALSE( s.contains( i.nKey ));
+ ASSERT_FALSE( s.contains( i ));
+ ASSERT_FALSE( s.contains( other_item( i.key()), other_predicate()));
+ ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ));
+ ASSERT_FALSE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} ));
+ }
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+
+ // clear
+ for ( auto& i : data ) {
+ i.clear_stat();
+ ASSERT_TRUE( s.insert( i ));
+ }
+ ASSERT_FALSE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
+
+ s.clear();
+
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+ for ( auto& i : data ) {
+ EXPECT_EQ( i.nDisposeCount, 1 );
+ }
+ }
+ };
+
+} // namespace cds_test
+
+#endif // #ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_H