mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1175485 part 1 - Allow inner iterator of ReverseIterator deref to any type, and change IntegerIterator, EnumeratedRange, and nsFrameList::Iterator to return value type instead of a reference. r=roc,waldo
This commit is contained in:
parent
be47f0e5c5
commit
d33f9fcb90
@ -451,7 +451,7 @@ public:
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
typedef nsIFrame* const ValueType;
|
||||
typedef nsIFrame* ValueType;
|
||||
// Though we don't support +/- a integer currently,
|
||||
// iterators have to have a DifferenceType.
|
||||
typedef ptrdiff_t DifferenceType;
|
||||
@ -466,7 +466,7 @@ public:
|
||||
, mCurrent(aOther.mCurrent)
|
||||
{}
|
||||
|
||||
ValueType& operator*() const { return mCurrent; }
|
||||
nsIFrame* operator*() const { return mCurrent; }
|
||||
|
||||
// The operators need to know about nsIFrame, hence the
|
||||
// implementations are in nsIFrame.h
|
||||
|
@ -20,8 +20,8 @@
|
||||
#ifndef mozilla_EnumeratedRange_h
|
||||
#define mozilla_EnumeratedRange_h
|
||||
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -31,7 +31,7 @@ template<typename IntTypeT, typename EnumTypeT>
|
||||
class EnumeratedIterator
|
||||
{
|
||||
public:
|
||||
typedef const EnumTypeT ValueType;
|
||||
typedef EnumTypeT ValueType;
|
||||
typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
|
||||
|
||||
template<typename EnumType>
|
||||
@ -42,9 +42,7 @@ public:
|
||||
EnumeratedIterator(const EnumeratedIterator<IntType, EnumType>& aOther)
|
||||
: mCurrent(aOther.mCurrent) { }
|
||||
|
||||
// Since operator* is required to return a reference, we return
|
||||
// a reference to our member here.
|
||||
const EnumTypeT& operator*() const { return mCurrent; }
|
||||
EnumTypeT operator*() const { return mCurrent; }
|
||||
|
||||
/* Increment and decrement operators */
|
||||
|
||||
|
@ -21,7 +21,7 @@ template<typename IntTypeT>
|
||||
class IntegerIterator
|
||||
{
|
||||
public:
|
||||
typedef const IntTypeT ValueType;
|
||||
typedef IntTypeT ValueType;
|
||||
typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
|
||||
|
||||
template<typename IntType>
|
||||
@ -32,9 +32,7 @@ public:
|
||||
IntegerIterator(const IntegerIterator<IntType>& aOther)
|
||||
: mCurrent(aOther.mCurrent) { }
|
||||
|
||||
// Since operator* is required to return a reference, we return
|
||||
// a reference to our member here.
|
||||
const IntTypeT& operator*() const { return mCurrent; }
|
||||
IntTypeT operator*() const { return mCurrent; }
|
||||
|
||||
/* Increment and decrement operators */
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/IteratorTraits.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -31,7 +32,7 @@ public:
|
||||
MOZ_IMPLICIT ReverseIterator(const ReverseIterator<Iterator>& aOther)
|
||||
: mCurrent(aOther.mCurrent) { }
|
||||
|
||||
ValueType& operator*() const
|
||||
decltype(*DeclVal<IteratorT>()) operator*() const
|
||||
{
|
||||
IteratorT tmp = mCurrent;
|
||||
return *--tmp;
|
||||
|
Loading…
Reference in New Issue
Block a user