提交 3f36c89f 编写于 作者: B Behdad Esfahbod

Inline explicit_operator macro

Now that we require C++11, no need to macro.
上级 1d75db19
......@@ -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. */
......
......@@ -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 (); }
......
......@@ -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); }
......
......@@ -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; }
......
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册