[algs] Use std::move instead of hb_move()
This commit is contained in:
parent
896e0c74a8
commit
811f80a701
|
@ -159,7 +159,7 @@ struct hb_hashmap_t
|
||||||
if (old_items[i].is_real ())
|
if (old_items[i].is_real ())
|
||||||
set_with_hash (old_items[i].key,
|
set_with_hash (old_items[i].key,
|
||||||
old_items[i].hash,
|
old_items[i].hash,
|
||||||
hb_move (old_items[i].value));
|
std::move (old_items[i].value));
|
||||||
|
|
||||||
hb_free (old_items);
|
hb_free (old_items);
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ struct hb_hashmap_t
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set (K key, const V& value) { return set_with_hash (key, hb_hash (key), value); }
|
bool set (K key, const V& value) { return set_with_hash (key, hb_hash (key), value); }
|
||||||
bool set (K key, V&& value) { return set_with_hash (key, hb_hash (key), hb_move (value)); }
|
bool set (K key, V&& value) { return set_with_hash (key, hb_hash (key), std::move (value)); }
|
||||||
|
|
||||||
V get (K key) const
|
V get (K key) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hb.hh"
|
#include "hb.hh"
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -174,10 +175,7 @@ using hb_is_cr_convertible = hb_bool_constant<
|
||||||
>;
|
>;
|
||||||
#define hb_is_cr_convertible(From,To) hb_is_cr_convertible<From, To>::value
|
#define hb_is_cr_convertible(From,To) hb_is_cr_convertible<From, To>::value
|
||||||
|
|
||||||
/* std::move and std::forward */
|
/* std::forward */
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static constexpr hb_remove_reference<T>&& hb_move (T&& t) { return (hb_remove_reference<T>&&) (t); }
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr T&& hb_forward (hb_remove_reference<T>& t) { return (T&&) t; }
|
static constexpr T&& hb_forward (hb_remove_reference<T>& t) { return (T&&) t; }
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct hb_sparseset_t
|
||||||
~hb_sparseset_t () { fini (); }
|
~hb_sparseset_t () { fini (); }
|
||||||
|
|
||||||
hb_sparseset_t (const hb_sparseset_t& other) : hb_sparseset_t () { set (other); }
|
hb_sparseset_t (const hb_sparseset_t& other) : hb_sparseset_t () { set (other); }
|
||||||
hb_sparseset_t (hb_sparseset_t&& other) : hb_sparseset_t () { s = hb_move (other.s); }
|
hb_sparseset_t (hb_sparseset_t&& other) : hb_sparseset_t () { s = std::move (other.s); }
|
||||||
hb_sparseset_t& operator= (const hb_sparseset_t& other) { set (other); return *this; }
|
hb_sparseset_t& operator= (const hb_sparseset_t& other) { set (other); return *this; }
|
||||||
hb_sparseset_t& operator= (hb_sparseset_t&& other) { hb_swap (*this, other); return *this; }
|
hb_sparseset_t& operator= (hb_sparseset_t&& other) { hb_swap (*this, other); return *this; }
|
||||||
friend void swap (hb_sparseset_t& a, hb_sparseset_t& b) { hb_swap (a.s, b.s); }
|
friend void swap (hb_sparseset_t& a, hb_sparseset_t& b) { hb_swap (a.s, b.s); }
|
||||||
|
|
|
@ -255,7 +255,7 @@ struct hb_vector_t
|
||||||
Type pop ()
|
Type pop ()
|
||||||
{
|
{
|
||||||
if (!length) return Null (Type);
|
if (!length) return Null (Type);
|
||||||
return hb_move (arrayZ[--length]); /* Does this move actually work? */
|
return std::move (arrayZ[--length]); /* Does this move actually work? */
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove (unsigned int i)
|
void remove (unsigned int i)
|
||||||
|
|
Loading…
Reference in New Issue