Rename HB_AUTO_RETURN_EXPR to HB_AUTO_RETURN

pull/1670/head
Behdad Esfahbod 6 years ago
parent da293b0e59
commit 5b33427f2c
  1. 34
      src/hb-algs.hh
  2. 8
      src/hb-meta.hh

@ -50,11 +50,11 @@ struct
{ {
private: private:
template <typename T> auto template <typename T> auto
impl (const T& v, hb_priority<1>) const HB_AUTO_RETURN_EXPR (hb_deref_pointer (v).hash ()) impl (const T& v, hb_priority<1>) const HB_AUTO_RETURN (hb_deref_pointer (v).hash ())
template <typename T, template <typename T,
hb_enable_if (hb_is_integer (T))> auto hb_enable_if (hb_is_integer (T))> auto
impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN_EXPR impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN
( (
/* Knuth's multiplicative method: */ /* Knuth's multiplicative method: */
(uint32_t) v * 2654435761u (uint32_t) v * 2654435761u
@ -63,7 +63,7 @@ struct
public: public:
template <typename T> auto template <typename T> auto
operator () (const T& v) const HB_AUTO_RETURN_EXPR ((uint32_t) impl (v, hb_prioritize)) operator () (const T& v) const HB_AUTO_RETURN ((uint32_t) impl (v, hb_prioritize))
} HB_FUNCOBJ (hb_hash); } HB_FUNCOBJ (hb_hash);
struct struct
@ -72,23 +72,23 @@ struct
/* Pointer-to-member-function. */ /* Pointer-to-member-function. */
template <typename Appl, typename Val> auto template <typename Appl, typename Val> auto
impl (Appl&& a, Val &&v, hb_priority<2>) const HB_AUTO_RETURN_EXPR impl (Appl&& a, Val &&v, hb_priority<2>) const HB_AUTO_RETURN
(hb_forward<Val> (hb_deref_pointer (v)).*a ()) (hb_forward<Val> (hb_deref_pointer (v)).*a ())
/* Pointer-to-member. */ /* Pointer-to-member. */
template <typename Appl, typename Val> auto template <typename Appl, typename Val> auto
impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR impl (Appl&& a, Val &&v, hb_priority<1>) const HB_AUTO_RETURN
(hb_forward<Val> (hb_deref_pointer (v)).*a) (hb_forward<Val> (hb_deref_pointer (v)).*a)
/* Operator(). */ /* Operator(). */
template <typename Appl, typename Val> auto template <typename Appl, typename Val> auto
impl (Appl&& a, Val &&v, hb_priority<0>) const HB_AUTO_RETURN_EXPR impl (Appl&& a, Val &&v, hb_priority<0>) const HB_AUTO_RETURN
(hb_deref_pointer (a) (hb_forward<Val> (v))) (hb_deref_pointer (a) (hb_forward<Val> (v)))
public: public:
template <typename Appl, typename Val> auto template <typename Appl, typename Val> auto
operator () (Appl&& a, Val &&v) const HB_AUTO_RETURN_EXPR operator () (Appl&& a, Val &&v) const HB_AUTO_RETURN
( (
impl (hb_forward<Appl> (a), impl (hb_forward<Appl> (a),
hb_forward<Val> (v), hb_forward<Val> (v),
@ -101,11 +101,11 @@ struct
private: private:
template <typename Pred, typename Val> auto template <typename Pred, typename Val> auto
impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN
(hb_deref_pointer (p).has (v)) (hb_deref_pointer (p).has (v))
template <typename Pred, typename Val> auto template <typename Pred, typename Val> auto
impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN_EXPR impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN
( (
hb_invoke (hb_forward<Pred> (p), hb_invoke (hb_forward<Pred> (p),
hb_forward<Val> (v)) hb_forward<Val> (v))
@ -114,7 +114,7 @@ struct
public: public:
template <typename Pred, typename Val> auto template <typename Pred, typename Val> auto
operator () (Pred&& p, Val &&v) const HB_AUTO_RETURN_EXPR operator () (Pred&& p, Val &&v) const HB_AUTO_RETURN
( (
(bool) impl (hb_forward<Pred> (p), (bool) impl (hb_forward<Pred> (p),
hb_forward<Val> (v), hb_forward<Val> (v),
@ -127,11 +127,11 @@ struct
private: private:
template <typename Proj, typename Val> auto template <typename Proj, typename Val> auto
impl (Proj&& f, Val &&v, hb_priority<1>) const HB_AUTO_RETURN_EXPR impl (Proj&& f, Val &&v, hb_priority<1>) const HB_AUTO_RETURN
(hb_deref_pointer (f).get (hb_forward<Val> (v))) (hb_deref_pointer (f).get (hb_forward<Val> (v)))
template <typename Proj, typename Val> auto template <typename Proj, typename Val> auto
impl (Proj&& f, Val &&v, hb_priority<0>) const HB_AUTO_RETURN_EXPR impl (Proj&& f, Val &&v, hb_priority<0>) const HB_AUTO_RETURN
( (
hb_invoke (hb_forward<Proj> (f), hb_invoke (hb_forward<Proj> (f),
hb_forward<Val> (v)) hb_forward<Val> (v))
@ -140,7 +140,7 @@ struct
public: public:
template <typename Proj, typename Val> auto template <typename Proj, typename Val> auto
operator () (Proj&& f, Val &&v) const HB_AUTO_RETURN_EXPR operator () (Proj&& f, Val &&v) const HB_AUTO_RETURN
( (
impl (hb_forward<Proj> (f), impl (hb_forward<Proj> (f),
hb_forward<Val> (v), hb_forward<Val> (v),
@ -170,24 +170,24 @@ hb_pair (T1&& a, T2&& b) { return hb_pair_t<T1, T2> (a, b); }
struct struct
{ {
template <typename Pair> auto template <typename Pair> auto
operator () (const Pair& pair) const HB_AUTO_RETURN_EXPR (pair.first) operator () (const Pair& pair) const HB_AUTO_RETURN (pair.first)
} HB_FUNCOBJ (hb_first); } HB_FUNCOBJ (hb_first);
struct struct
{ {
template <typename Pair> auto template <typename Pair> auto
operator () (const Pair& pair) const HB_AUTO_RETURN_EXPR (pair.second) operator () (const Pair& pair) const HB_AUTO_RETURN (pair.second)
} HB_FUNCOBJ (hb_second); } HB_FUNCOBJ (hb_second);
struct struct
{ {
template <typename T, typename T2> auto template <typename T, typename T2> auto
operator () (const T& a, const T2& b) const HB_AUTO_RETURN_EXPR (a <= b ? a : b) operator () (const T& a, const T2& b) const HB_AUTO_RETURN (a <= b ? a : b)
} HB_FUNCOBJ (hb_min); } HB_FUNCOBJ (hb_min);
struct struct
{ {
template <typename T, typename T2> auto template <typename T, typename T2> auto
operator () (const T& a, const T2& b) const HB_AUTO_RETURN_EXPR (a >= b ? a : b) operator () (const T& a, const T2& b) const HB_AUTO_RETURN (a >= b ? a : b)
} HB_FUNCOBJ (hb_max); } HB_FUNCOBJ (hb_max);

@ -36,8 +36,8 @@
/* Function overloading SFINAE and priority. */ /* Function overloading SFINAE and priority. */
#define HB_AUTO_RETURN_EXPR(E) -> decltype ((E)) { return (E); } #define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); }
#define HB_VOID_RETURN_EXPR(E) -> hb_void_tt<decltype ((E))> { (E); } #define HB_VOID_RETURN(E) -> hb_void_tt<decltype ((E))> { (E); }
template <unsigned Pri> struct hb_priority : hb_priority<Pri - 1> {}; template <unsigned Pri> struct hb_priority : hb_priority<Pri - 1> {};
template <> struct hb_priority<0> {}; template <> struct hb_priority<0> {};
@ -90,10 +90,10 @@ static T&& hb_forward (hb_remove_reference<T>&& t) { return (T&&) t; }
struct struct
{ {
template <typename T> auto template <typename T> auto
operator () (T&& v) const HB_AUTO_RETURN_EXPR (hb_forward<T> (v)) operator () (T&& v) const HB_AUTO_RETURN (hb_forward<T> (v))
template <typename T> auto template <typename T> auto
operator () (T *v) const HB_AUTO_RETURN_EXPR (*v) operator () (T *v) const HB_AUTO_RETURN (*v)
} HB_FUNCOBJ (hb_deref_pointer); } HB_FUNCOBJ (hb_deref_pointer);

Loading…
Cancel
Save