@ -186,7 +186,7 @@ struct hb_hashmap_t
{
{
if ( old_items [ i ] . is_real ( ) )
if ( old_items [ i ] . is_real ( ) )
{
{
set_with_hash ( std : : move ( old_items [ i ] . key ) ,
set_with_hash ( old_items [ i ] . key ,
old_items [ i ] . hash ,
old_items [ i ] . hash ,
std : : move ( old_items [ i ] . value ) ) ;
std : : move ( old_items [ i ] . value ) ) ;
}
}
@ -199,9 +199,7 @@ struct hb_hashmap_t
}
}
template < typename VV >
template < typename VV >
bool set ( const K & key , VV & & value ) { return set_with_hash ( hb_ridentity ( key ) , hb_hash ( key ) , std : : forward < VV > ( value ) ) ; }
bool set ( K key , VV & & value ) { return set_with_hash ( key , hb_hash ( key ) , std : : forward < VV > ( value ) ) ; }
template < typename VV >
bool set ( K & & key , VV & & value ) { return set_with_hash ( std : : move ( key ) , hb_hash ( key ) , std : : forward < VV > ( value ) ) ; }
const V & get ( K key ) const
const V & get ( K key ) const
{
{
@ -210,8 +208,7 @@ struct hb_hashmap_t
return item . is_real ( ) & & item = = key ? item . value : item_t : : default_value ( ) ;
return item . is_real ( ) & & item = = key ? item . value : item_t : : default_value ( ) ;
}
}
void del ( const K & key ) { set_with_hash ( hb_ridentity ( key ) , hb_hash ( key ) , item_t : : default_value ( ) , true ) ; }
void del ( K key ) { set_with_hash ( key , hb_hash ( key ) , item_t : : default_value ( ) , true ) ; }
void del ( K & & key ) { set_with_hash ( std : : move ( key ) , hb_hash ( key ) , item_t : : default_value ( ) , true ) ; }
/* Has interface. */
/* Has interface. */
typedef const V & value_t ;
typedef const V & value_t ;
@ -327,8 +324,8 @@ struct hb_hashmap_t
protected :
protected :
template < typename KK , typename VV >
template < typename VV >
bool set_with_hash ( KK & & key , uint32_t hash , VV & & value , bool is_delete = false )
bool set_with_hash ( K key , uint32_t hash , VV & & value , bool is_delete = false )
{
{
if ( unlikely ( ! successful ) ) return false ;
if ( unlikely ( ! successful ) ) return false ;
if ( unlikely ( ( occupancy + occupancy / 2 ) > = mask & & ! resize ( ) ) ) return false ;
if ( unlikely ( ( occupancy + occupancy / 2 ) > = mask & & ! resize ( ) ) ) return false ;
@ -344,7 +341,7 @@ struct hb_hashmap_t
population - - ;
population - - ;
}
}
item . key = std : : forward < KK > ( key ) ;
item . key = key ;
item . value = std : : forward < VV > ( value ) ;
item . value = std : : forward < VV > ( value ) ;
item . hash = hash ;
item . hash = hash ;
item . set_used ( true ) ;
item . set_used ( true ) ;