Minor: Use template parameter default values for OffsetTo

This commit is contained in:
Behdad Esfahbod 2014-06-26 19:13:34 -04:00
parent 546b1adcdc
commit 0d1b3419a7
1 changed files with 5 additions and 8 deletions

View File

@ -696,8 +696,8 @@ struct FixedVersion
* Use: (base+offset)
*/
template <typename OffsetType, typename Type>
struct GenericOffsetTo : OffsetType
template <typename Type, typename OffsetType=Offset>
struct OffsetTo : OffsetType
{
inline const Type& operator () (const void *base) const
{
@ -737,15 +737,12 @@ struct GenericOffsetTo : OffsetType
}
};
template <typename Base, typename OffsetType, typename Type>
static inline const Type& operator + (const Base &base, const GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType> &offset) { return offset (base); }
template <typename Base, typename OffsetType, typename Type>
static inline Type& operator + (Base &base, GenericOffsetTo<OffsetType, Type> &offset) { return offset (base); }
static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset) { return offset (base); }
template <typename Type>
struct OffsetTo : GenericOffsetTo<Offset, Type> {};
template <typename Type>
struct LongOffsetTo : GenericOffsetTo<LongOffset, Type> {};
struct LongOffsetTo : OffsetTo<Type, LongOffset> {};
/*