From 4fc2d2d7248171c386c39630aa2612f240669a58 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Apr 2019 11:24:42 -0400 Subject: [PATCH] [meta] Flesh out hb_invoke() --- src/hb-algs.hh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 7d19bd899..6981d06ae 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -75,11 +75,21 @@ struct { private: - // TODO Add overload to for pointer-to-member and pointer-to-member-function ala std::invoke + /* Pointer-to-member-function. */ + template auto + impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (hb_forward (v).*a ()) + template auto + impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (hb_forward (v)->*a ()) + /* Pointer-to-member. */ + template auto + impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (hb_forward (v).*a) + template auto + impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (hb_forward (v)->*a) + + /* Operator(). */ template auto impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (a (hb_forward (v))) - template auto impl (Appl&& a, Val &&v, hb_priority<0>) const HB_AUTO_RETURN_EXPR ((*a) (hb_forward (v)))