From 3f36c89f2ea16e293f8af7e7f549ebcd7247ea97 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 29 Mar 2019 15:22:46 -0700 Subject: [PATCH] Inline explicit_operator macro Now that we require C++11, no need to macro. --- src/hb-iter.hh | 2 +- src/hb-machinery.hh | 2 +- src/hb-open-type.hh | 2 +- src/hb-vector.hh | 6 +++--- src/hb.hh | 5 ----- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 6672830c2..917ffc748 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -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. */ diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index ffa423d2f..80bbfa645 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -816,7 +816,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t 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 operator const C * () const { return get (); } diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 453b4fbf4..c4b54c7b8 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -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 as_array () const { return hb_array (arrayZ, len); } diff --git a/src/hb-vector.hh b/src/hb-vector.hh index d83719e45..62758758c 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -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 as_sorted_array () const { return hb_sorted_array (arrayZ(), length); } - template explicit_operator T * () { return arrayZ(); } - template explicit_operator const T * () const { return arrayZ(); } + template explicit operator T * () { return arrayZ(); } + template 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; } diff --git a/src/hb.hh b/src/hb.hh index feb69f9c8..93c116272 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -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))