Inline explicit_operator macro

Now that we require C++11, no need to macro.
This commit is contained in:
Behdad Esfahbod 2019-03-29 15:22:46 -07:00
parent 1d75db19fb
commit 3f36c89f2e
5 changed files with 6 additions and 11 deletions

View File

@ -69,7 +69,7 @@ struct hb_iter_t
/* Operators. */
iter_t iter () const { return *thiz(); }
iter_t operator + () const { return *thiz(); }
explicit_operator bool () const { return thiz()->__more__ (); }
explicit operator bool () const { return thiz()->__more__ (); }
unsigned len () const { return thiz()->__len__ (); }
/* The following can only be enabled if item_t is reference type. Otherwise
* it will be returning pointer to temporary rvalue. */

View File

@ -816,7 +816,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
const Returned * operator -> () const { return get (); }
const Returned & operator * () const { return *get (); }
explicit_operator bool () const
explicit operator bool () const
{ return get_stored () != Funcs::get_null (); }
template <typename C> operator const C * () const { return get (); }

View File

@ -529,7 +529,7 @@ struct ArrayOf
unsigned int get_size () const
{ return len.static_size + len * Type::static_size; }
explicit_operator bool () const { return len; }
explicit operator bool () const { return len; }
hb_array_t< Type> as_array () { return hb_array (arrayZ, len); }
hb_array_t<const Type> as_array () const { return hb_array (arrayZ, len); }

View File

@ -87,7 +87,7 @@ struct hb_vector_t
return arrayZ()[i];
}
explicit_operator bool () const { return length; }
explicit operator bool () const { return length; }
/* Sink interface. */
hb_vector_t& operator << (const Type &v) { push (v); return *this; }
@ -117,8 +117,8 @@ struct hb_vector_t
hb_sorted_array_t<const Type> as_sorted_array () const
{ return hb_sorted_array (arrayZ(), length); }
template <typename T> explicit_operator T * () { return arrayZ(); }
template <typename T> explicit_operator const T * () const { return arrayZ(); }
template <typename T> explicit operator T * () { return arrayZ(); }
template <typename T> explicit operator const T * () const { return arrayZ(); }
Type * operator + (unsigned int i) { return arrayZ() + i; }
const Type * operator + (unsigned int i) const { return arrayZ() + i; }

View File

@ -215,11 +215,6 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
* Compiler attributes
*/
/* https://github.com/harfbuzz/harfbuzz/issues/1127 */
#ifndef explicit_operator
#define explicit_operator explicit operator
#endif
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
#define likely(expr) (__builtin_expect (!!(expr), 1))
#define unlikely(expr) (__builtin_expect (!!(expr), 0))