提交 e01c7b16 编写于 作者: B Behdad Esfahbod

Move OffsetTo operator+ back out of class

Apparently there's different overload resolution rules that apply, at
least with some (older?) version of gcc.

hb-ot-name-table.hh: In member function ‘void OT::name::accelerator_t::init(hb_face_t*)’:
hb-ot-name-table.hh:244:62: error: ambiguous overload for ‘operator+’ (operand types are ‘hb_blob_ptr_t<OT::name>’ and ‘OT::NNOffsetTo<OT::UnsizedArrayOf<OT::IntType<unsigned char, 1u> > > {aka const OT::OffsetTo<OT::UnsizedArrayOf<OT::IntType<unsigned char, 1u> >, OT::IntType<short unsigned int, 2u>, false>}’)
       this->pool = (const char *) (const void *) (this->table+this->table->stringOffset);
                                                              ^
hb-ot-name-table.hh:244:62: note: candidates are:
hb-ot-name-table.hh:244:62: note: operator+(const C*, long int) <built-in>
hb-ot-name-table.hh:244:62: note: operator+(const char*, long int) <built-in>
上级 b213042f
...@@ -279,15 +279,6 @@ struct OffsetTo : Offset<OffsetType, has_null> ...@@ -279,15 +279,6 @@ struct OffsetTo : Offset<OffsetType, has_null>
return StructAtOffset<Type> (base, *this); return StructAtOffset<Type> (base, *this);
} }
template <typename Base>
friend const Type& operator + (const Base *base, const OffsetTo &offset) { return offset (base); }
template <typename Base>
friend const Type& operator + (const OffsetTo &offset, const Base *base) { return offset (base); }
template <typename Base>
friend Type& operator + (Base *base, OffsetTo &offset) { return offset (base); }
template <typename Base>
friend Type& operator + (OffsetTo &offset, Base *base) { return offset (base); }
Type& serialize (hb_serialize_context_t *c, const void *base) Type& serialize (hb_serialize_context_t *c, const void *base)
{ {
return * (Type *) Offset<OffsetType>::serialize (c, base); return * (Type *) Offset<OffsetType>::serialize (c, base);
...@@ -366,6 +357,15 @@ using NNOffsetTo = OffsetTo<Type, OffsetType, false>; ...@@ -366,6 +357,15 @@ using NNOffsetTo = OffsetTo<Type, OffsetType, false>;
template <typename Type> template <typename Type>
using LNNOffsetTo = LOffsetTo<Type, false>; using LNNOffsetTo = LOffsetTo<Type, false>;
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true, typename Base>
static inline const Type& operator + (const Base *base, const OffsetTo<Type, OffsetType, has_null> &offset) { return offset (base); }
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true, typename Base>
static inline const Type& operator + (const OffsetTo<Type, OffsetType, has_null> &offset, const Base *base) { return offset (base); }
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true, typename Base>
static inline Type& operator + (Base *base, OffsetTo<Type, OffsetType, has_null> &offset) { return offset (base); }
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true, typename Base>
static inline Type& operator + (OffsetTo<Type, OffsetType, has_null> &offset, Base *base) { return offset (base); }
/* /*
* Array Types * Array Types
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册