[map] Use hb_invoke() with pointer-to-method
This commit is contained in:
parent
8f79a5750e
commit
0268db1196
|
@ -73,7 +73,7 @@ struct
|
||||||
/* Pointer-to-member-function. */
|
/* Pointer-to-member-function. */
|
||||||
template <typename Appl, typename Val1, typename ...Vals> auto
|
template <typename Appl, typename Val1, typename ...Vals> auto
|
||||||
impl (Appl&& a, hb_priority<2>, Val1 &&v1, Vals &&...vs) const HB_AUTO_RETURN
|
impl (Appl&& a, hb_priority<2>, Val1 &&v1, Vals &&...vs) const HB_AUTO_RETURN
|
||||||
(hb_deref_pointer (hb_forward<Val1> (v1)).*hb_forward<Appl> (a) (hb_forward<Vals> (vs)...))
|
((hb_deref_pointer (hb_forward<Val1> (v1)).*hb_forward<Appl> (a)) (hb_forward<Vals> (vs)...))
|
||||||
|
|
||||||
/* Pointer-to-member. */
|
/* Pointer-to-member. */
|
||||||
template <typename Appl, typename Val> auto
|
template <typename Appl, typename Val> auto
|
||||||
|
@ -86,6 +86,9 @@ struct
|
||||||
(hb_deref_pointer (hb_forward<Appl> (a)) (hb_forward<Vals> (vs)...))
|
(hb_deref_pointer (hb_forward<Appl> (a)) (hb_forward<Vals> (vs)...))
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
template <typename Appl, typename Val1, typename ...Vals> auto
|
||||||
|
impl2 (Appl&& a, hb_priority<2>, Val1 &&v1, Vals &&...vs) const HB_AUTO_RETURN
|
||||||
|
(hb_deref_pointer (hb_forward<Val1> (v1)).*hb_forward<Appl> (a) (hb_forward<Vals> (vs)...))
|
||||||
|
|
||||||
template <typename Appl, typename ...Vals> auto
|
template <typename Appl, typename ...Vals> auto
|
||||||
operator () (Appl&& a, Vals &&...vs) const HB_AUTO_RETURN
|
operator () (Appl&& a, Vals &&...vs) const HB_AUTO_RETURN
|
||||||
|
|
|
@ -122,7 +122,7 @@ struct hb_hashmap_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
+ hb_iter (new_items, new_size)
|
+ hb_iter (new_items, new_size)
|
||||||
| hb_apply ([] (item_t &_) { _.clear (); }) /* TODO make pointer-to-methods invokable. */
|
| hb_apply (&item_t::clear)
|
||||||
;
|
;
|
||||||
|
|
||||||
unsigned int old_size = mask + 1;
|
unsigned int old_size = mask + 1;
|
||||||
|
@ -193,7 +193,7 @@ struct hb_hashmap_t
|
||||||
return;
|
return;
|
||||||
if (items)
|
if (items)
|
||||||
+ hb_iter (items, mask + 1)
|
+ hb_iter (items, mask + 1)
|
||||||
| hb_apply ([] (item_t &_) { _.clear (); }) /* TODO make pointer-to-methods invokable. */
|
| hb_apply (&item_t::clear)
|
||||||
;
|
;
|
||||||
|
|
||||||
population = occupancy = 0;
|
population = occupancy = 0;
|
||||||
|
|
|
@ -34,6 +34,11 @@ test_func (int a, char **b)
|
||||||
return b ? b[a] : nullptr;
|
return b ? b[a] : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
void a () {}
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -54,5 +59,8 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
hb_invoke (test_func, 0, nullptr);
|
hb_invoke (test_func, 0, nullptr);
|
||||||
|
|
||||||
|
A a;
|
||||||
|
hb_invoke (&A::a, a);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue