From 5ce6110994cbe2f1386981bbd711169d76d6fea8 Mon Sep 17 00:00:00 2001
From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Thu, 2 Jul 2015 13:31:07 +1000
Subject: [PATCH] Bug 1175485 part 3 - Remove unused operators, typedefs and
 IteratorTraits. r=waldo

--HG--
extra : source : c1d3256e987c25935cc8bd321c413a1e0c7586b3
---
 layout/generic/nsFrameList.h |  5 -----
 mfbt/EnumeratedRange.h       | 22 --------------------
 mfbt/IntegerRange.h          | 22 --------------------
 mfbt/IteratorTraits.h        | 39 ------------------------------------
 mfbt/ReverseIterator.h       | 23 ---------------------
 mfbt/moz.build               |  1 -
 6 files changed, 112 deletions(-)
 delete mode 100644 mfbt/IteratorTraits.h

diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h
index 5a2fcce9d86fc..7286cbd28c180 100644
--- a/layout/generic/nsFrameList.h
+++ b/layout/generic/nsFrameList.h
@@ -451,11 +451,6 @@ public:
   class Iterator
   {
   public:
-    typedef nsIFrame* ValueType;
-    // Though we don't support +/- a integer currently,
-    // iterators have to have a DifferenceType.
-    typedef ptrdiff_t DifferenceType;
-
     Iterator(const nsFrameList& aList, nsIFrame* aCurrent)
       : mList(aList)
       , mCurrent(aCurrent)
diff --git a/mfbt/EnumeratedRange.h b/mfbt/EnumeratedRange.h
index a8c591032766b..7f0c18b7ff869 100644
--- a/mfbt/EnumeratedRange.h
+++ b/mfbt/EnumeratedRange.h
@@ -31,9 +31,6 @@ template<typename IntTypeT, typename EnumTypeT>
 class EnumeratedIterator
 {
 public:
-  typedef EnumTypeT ValueType;
-  typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
-
   template<typename EnumType>
   explicit EnumeratedIterator(EnumType aCurrent)
     : mCurrent(aCurrent) { }
@@ -69,25 +66,6 @@ public:
     return ret;
   }
 
-  EnumeratedIterator operator+(DifferenceType aN) const
-  {
-    return EnumeratedIterator(EnumTypeT(IntTypeT(mCurrent) + aN));
-  }
-  EnumeratedIterator operator-(DifferenceType aN) const
-  {
-    return EnumeratedIterator(EnumTypeT(IntTypeT(mCurrent) - aN));
-  }
-  EnumeratedIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent = EnumTypeT(IntTypeT(mCurrent) + aN);
-    return *this;
-  }
-  EnumeratedIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent = EnumTypeT(IntTypeT(mCurrent) - aN);
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename IntType, typename EnumType>
diff --git a/mfbt/IntegerRange.h b/mfbt/IntegerRange.h
index ee3a2fa9da884..2ebfb3914533d 100644
--- a/mfbt/IntegerRange.h
+++ b/mfbt/IntegerRange.h
@@ -21,9 +21,6 @@ template<typename IntTypeT>
 class IntegerIterator
 {
 public:
-  typedef IntTypeT ValueType;
-  typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
-
   template<typename IntType>
   explicit IntegerIterator(IntType aCurrent)
     : mCurrent(aCurrent) { }
@@ -41,25 +38,6 @@ public:
   IntegerIterator operator++(int) { auto ret = *this; ++mCurrent; return ret; }
   IntegerIterator operator--(int) { auto ret = *this; --mCurrent; return ret; }
 
-  IntegerIterator operator+(DifferenceType aN) const
-  {
-    return IntegerIterator(mCurrent + aN);
-  }
-  IntegerIterator operator-(DifferenceType aN) const
-  {
-    return IntegerIterator(mCurrent - aN);
-  }
-  IntegerIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent += aN;
-    return *this;
-  }
-  IntegerIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent -= aN;
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename IntType1, typename IntType2>
diff --git a/mfbt/IteratorTraits.h b/mfbt/IteratorTraits.h
deleted file mode 100644
index e7ee622dfa41a..0000000000000
--- a/mfbt/IteratorTraits.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Iterator traits to expose a value type and a difference type */
-
-#ifndef mozilla_IteratorTraits_h
-#define mozilla_IteratorTraits_h
-
-#include <stddef.h>
-
-namespace mozilla {
-
-template<typename Iterator>
-struct IteratorTraits
-{
-  typedef typename Iterator::ValueType ValueType;
-  typedef typename Iterator::DifferenceType DifferenceType;
-};
-
-template<typename T>
-struct IteratorTraits<T*>
-{
-  typedef T ValueType;
-  typedef ptrdiff_t DifferenceType;
-};
-
-template<typename T>
-struct IteratorTraits<const T*>
-{
-  typedef const T ValueType;
-  typedef ptrdiff_t DifferenceType;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_IteratorTraits_h
diff --git a/mfbt/ReverseIterator.h b/mfbt/ReverseIterator.h
index 119b6ce722159..e1d247b65f820 100644
--- a/mfbt/ReverseIterator.h
+++ b/mfbt/ReverseIterator.h
@@ -12,7 +12,6 @@
 #define mozilla_ReverseIterator_h
 
 #include "mozilla/Attributes.h"
-#include "mozilla/IteratorTraits.h"
 #include "mozilla/TypeTraits.h"
 
 namespace mozilla {
@@ -21,9 +20,6 @@ template<typename IteratorT>
 class ReverseIterator
 {
 public:
-  typedef typename IteratorTraits<IteratorT>::ValueType ValueType;
-  typedef typename IteratorTraits<IteratorT>::DifferenceType DifferenceType;
-
   template<typename Iterator>
   explicit ReverseIterator(Iterator aIter)
     : mCurrent(aIter) { }
@@ -45,25 +41,6 @@ public:
   ReverseIterator operator++(int) { auto ret = *this; mCurrent--; return ret; }
   ReverseIterator operator--(int) { auto ret = *this; mCurrent++; return ret; }
 
-  ReverseIterator operator+(DifferenceType aN) const
-  {
-    return ReverseIterator(mCurrent - aN);
-  }
-  ReverseIterator operator-(DifferenceType aN) const
-  {
-    return ReverseIterator(mCurrent + aN);
-  }
-  ReverseIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent -= aN;
-    return *this;
-  }
-  ReverseIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent += aN;
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename Iterator1, typename Iterator2>
diff --git a/mfbt/moz.build b/mfbt/moz.build
index ab9a77c2f02fb..a805cc9ebd45c 100644
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -46,7 +46,6 @@ EXPORTS.mozilla = [
     'IntegerPrintfMacros.h',
     'IntegerRange.h',
     'IntegerTypeTraits.h',
-    'IteratorTraits.h',
     'JSONWriter.h',
     'Likely.h',
     'LinkedList.h',
-- 
GitLab