Add explicit to hb_auto_t 1param constructors

pull/1148/head
Behdad Esfahbod 6 years ago
parent c0a3f38f78
commit 967741e4c4
  1. 7
      src/hb-dsalgs.hh

@ -497,9 +497,10 @@ struct hb_auto_t : Type
* *
* Apparently if we template for all types, then gcc seems to * Apparently if we template for all types, then gcc seems to
* capture a reference argument in the type, but clang doesn't, * capture a reference argument in the type, but clang doesn't,
* causing unwanted copies and bugs that come with it. */ * causing unwanted copies and bugs that come with it. Ideally
template <typename T1> hb_auto_t (T1 *t1) { Type::init (t1); } * we should use C++11-style rvalue reference &&t1. */
template <typename T1> hb_auto_t (T1 &t1) { Type::init (t1); } template <typename T1> explicit hb_auto_t (T1 *t1) { Type::init (t1); }
template <typename T1> explicit hb_auto_t (T1 &t1) { Type::init (t1); }
~hb_auto_t (void) { Type::fini (); } ~hb_auto_t (void) { Type::fini (); }
private: /* Hide */ private: /* Hide */
void init (void) {} void init (void) {}

Loading…
Cancel
Save