[algs] Fix hb_inc/dec signature

This commit is contained in:
Behdad Esfahbod 2019-08-30 16:39:52 -05:00
parent b1378d8a21
commit 3bc86fb237
2 changed files with 7 additions and 2 deletions

View File

@ -82,6 +82,7 @@ HB_FUNCOBJ (hb_bool);
struct struct
{ {
private: private:
template <typename T> constexpr auto template <typename T> constexpr auto
impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ())
@ -997,13 +998,13 @@ HB_FUNCOBJ (hb_neg);
struct struct
{ {
template <typename T> constexpr auto template <typename T> constexpr auto
operator () (const T &a) const HB_AUTO_RETURN (++a) operator () (T &a) const HB_AUTO_RETURN (++a)
} }
HB_FUNCOBJ (hb_inc); HB_FUNCOBJ (hb_inc);
struct struct
{ {
template <typename T> constexpr auto template <typename T> constexpr auto
operator () (const T &a) const HB_AUTO_RETURN (--a) operator () (T &a) const HB_AUTO_RETURN (--a)
} }
HB_FUNCOBJ (hb_dec); HB_FUNCOBJ (hb_dec);

View File

@ -87,5 +87,9 @@ main (int argc, char **argv)
assert (hb_add (2) (5) == 7); assert (hb_add (2) (5) == 7);
assert (hb_add (5) (2) == 7); assert (hb_add (5) (2) == 7);
x = 1;
assert (++hb_inc (x) == 3);
assert (x == 3);
return 0; return 0;
} }