Add tsl::robin_map to uint32.cpp

This commit is contained in:
Peter Dimov
2022-07-22 18:36:50 +03:00
parent 912798e5cb
commit 0ca8c5f56f

View File

@ -18,6 +18,9 @@
#ifdef HAVE_TSL_HOPSCOTCH #ifdef HAVE_TSL_HOPSCOTCH
# include "tsl/hopscotch_map.h" # include "tsl/hopscotch_map.h"
#endif #endif
#ifdef HAVE_TSL_ROBIN
# include "tsl/robin_map.h"
#endif
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <memory> #include <memory>
@ -150,7 +153,14 @@ template<class Map> BOOST_NOINLINE void test_iteration( Map& map, std::chrono::s
{ {
if( it->second & 1 ) if( it->second & 1 )
{ {
map.erase( it++ ); if constexpr( std::is_void_v< decltype( map.erase( it ) ) > )
{
map.erase( it++ );
}
else
{
it = map.erase( it );
}
} }
else else
{ {
@ -325,6 +335,16 @@ template<class K, class V> using tsl_hopscotch_pg_map =
#endif #endif
#ifdef HAVE_TSL_ROBIN
template<class K, class V> using tsl_robin_map =
tsl::robin_map<K, V, std::hash<K>, std::equal_to<K>, ::allocator< std::pair<K, V> >>;
template<class K, class V> using tsl_robin_pg_map =
tsl::robin_pg_map<K, V, std::hash<K>, std::equal_to<K>, ::allocator< std::pair<K, V> >>;
#endif
int main() int main()
{ {
init_indices(); init_indices();
@ -345,6 +365,13 @@ int main()
test<tsl_hopscotch_map>( "tsl::hopscotch_map" ); test<tsl_hopscotch_map>( "tsl::hopscotch_map" );
test<tsl_hopscotch_pg_map>( "tsl::hopscotch_pg_map" ); test<tsl_hopscotch_pg_map>( "tsl::hopscotch_pg_map" );
#endif
#ifdef HAVE_TSL_ROBIN
test<tsl_robin_map>( "tsl::robin_map" );
test<tsl_robin_pg_map>( "tsl::robin_pg_map" );
#endif #endif
std::cout << "---\n\n"; std::cout << "---\n\n";