Inline explicit_operator macro
Now that we require C++11, no need to macro.
This commit is contained in:
parent
1d75db19fb
commit
3f36c89f2e
|
@ -69,7 +69,7 @@ struct hb_iter_t
|
||||||
/* Operators. */
|
/* Operators. */
|
||||||
iter_t iter () const { return *thiz(); }
|
iter_t iter () const { return *thiz(); }
|
||||||
iter_t operator + () 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__ (); }
|
unsigned len () const { return thiz()->__len__ (); }
|
||||||
/* The following can only be enabled if item_t is reference type. Otherwise
|
/* The following can only be enabled if item_t is reference type. Otherwise
|
||||||
* it will be returning pointer to temporary rvalue. */
|
* 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 (); }
|
||||||
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 (); }
|
{ return get_stored () != Funcs::get_null (); }
|
||||||
template <typename C> operator const C * () const { return get (); }
|
template <typename C> operator const C * () const { return get (); }
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ struct ArrayOf
|
||||||
unsigned int get_size () const
|
unsigned int get_size () const
|
||||||
{ return len.static_size + len * Type::static_size; }
|
{ 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< Type> as_array () { return hb_array (arrayZ, len); }
|
||||||
hb_array_t<const Type> as_array () const { 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];
|
return arrayZ()[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit_operator bool () const { return length; }
|
explicit operator bool () const { return length; }
|
||||||
|
|
||||||
/* Sink interface. */
|
/* Sink interface. */
|
||||||
hb_vector_t& operator << (const Type &v) { push (v); return *this; }
|
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
|
hb_sorted_array_t<const Type> as_sorted_array () const
|
||||||
{ return hb_sorted_array (arrayZ(), length); }
|
{ return hb_sorted_array (arrayZ(), length); }
|
||||||
|
|
||||||
template <typename T> explicit_operator T * () { return arrayZ(); }
|
template <typename T> explicit operator T * () { return arrayZ(); }
|
||||||
template <typename T> explicit_operator const T * () const { return arrayZ(); }
|
template <typename T> explicit operator const T * () const { return arrayZ(); }
|
||||||
|
|
||||||
Type * operator + (unsigned int i) { return arrayZ() + i; }
|
Type * operator + (unsigned int i) { return arrayZ() + i; }
|
||||||
const Type * operator + (unsigned int i) const { 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
|
* 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__)
|
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
|
||||||
#define likely(expr) (__builtin_expect (!!(expr), 1))
|
#define likely(expr) (__builtin_expect (!!(expr), 1))
|
||||||
#define unlikely(expr) (__builtin_expect (!!(expr), 0))
|
#define unlikely(expr) (__builtin_expect (!!(expr), 0))
|
||||||
|
|
Loading…
Reference in New Issue