[iter] Use is_sorted_iterator
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index da080ef..6a4c0b4 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -36,7 +36,7 @@
 
 
 static inline void SingleSubst_serialize (hb_serialize_context_t *c,
-					  hb_array_t<const GlyphID> glyphs,
+					  hb_sorted_array_t<const GlyphID> glyphs,
 					  hb_array_t<const GlyphID> substitutes);
 
 struct SingleSubstFormat1
@@ -92,7 +92,7 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  int delta)
   {
     TRACE_SERIALIZE (this);
@@ -107,7 +107,7 @@
     TRACE_SUBSET (this);
     const hb_set_t &glyphset = *c->plan->glyphset;
     const hb_map_t &glyph_map = *c->plan->glyph_map;
-    hb_vector_t<GlyphID> from;
+    hb_sorted_vector_t<GlyphID> from;
     hb_vector_t<GlyphID> to;
     hb_codepoint_t delta = deltaGlyphID;
     for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++)
@@ -189,7 +189,7 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const GlyphID> substitutes)
   {
     TRACE_SERIALIZE (this);
@@ -204,7 +204,7 @@
     TRACE_SUBSET (this);
     const hb_set_t &glyphset = *c->plan->glyphset;
     const hb_map_t &glyph_map = *c->plan->glyph_map;
-    hb_vector_t<GlyphID> from;
+    hb_sorted_vector_t<GlyphID> from;
     hb_vector_t<GlyphID> to;
     for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++)
     {
@@ -238,7 +238,7 @@
 struct SingleSubst
 {
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const GlyphID> substitutes)
   {
     TRACE_SERIALIZE (this);
@@ -286,7 +286,7 @@
 
 static inline void
 SingleSubst_serialize (hb_serialize_context_t *c,
-		       hb_array_t<const GlyphID> glyphs,
+		       hb_sorted_array_t<const GlyphID> glyphs,
 		       hb_array_t<const GlyphID> substitutes)
 { c->start_embed<SingleSubst> ()->serialize (c, glyphs, substitutes); }
 
@@ -335,10 +335,10 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs)
+		  hb_array_t<const GlyphID> subst)
   {
     TRACE_SERIALIZE (this);
-    return_trace (substitute.serialize (c, glyphs));
+    return_trace (substitute.serialize (c, subst));
   }
 
   bool sanitize (hb_sanitize_context_t *c) const
@@ -398,7 +398,7 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const unsigned int> substitute_len_list,
 		  hb_array_t<const GlyphID> substitute_glyphs_list)
   {
@@ -444,7 +444,7 @@
 struct MultipleSubst
 {
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const unsigned int> substitute_len_list,
 		  hb_array_t<const GlyphID> substitute_glyphs_list)
   {
@@ -514,10 +514,10 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs)
+		  hb_array_t<const GlyphID> alts)
   {
     TRACE_SERIALIZE (this);
-    return_trace (alternates.serialize (c, glyphs));
+    return_trace (alternates.serialize (c, alts));
   }
 
   bool sanitize (hb_sanitize_context_t *c) const
@@ -582,7 +582,7 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const unsigned int> alternate_len_list,
 		  hb_array_t<const GlyphID> alternate_glyphs_list)
   {
@@ -628,7 +628,7 @@
 struct AlternateSubst
 {
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> glyphs,
+		  hb_sorted_array_t<const GlyphID> glyphs,
 		  hb_array_t<const unsigned int> alternate_len_list,
 		  hb_array_t<const GlyphID> alternate_glyphs_list)
   {
@@ -917,7 +917,7 @@
   }
 
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> first_glyphs,
+		  hb_sorted_array_t<const GlyphID> first_glyphs,
 		  hb_array_t<const unsigned int> ligature_per_first_glyph_count_list,
 		  hb_array_t<const GlyphID> ligatures_list,
 		  hb_array_t<const unsigned int> component_count_list,
@@ -968,7 +968,7 @@
 struct LigatureSubst
 {
   bool serialize (hb_serialize_context_t *c,
-		  hb_array_t<const GlyphID> first_glyphs,
+		  hb_sorted_array_t<const GlyphID> first_glyphs,
 		  hb_array_t<const unsigned int> ligature_per_first_glyph_count_list,
 		  hb_array_t<const GlyphID> ligatures_list,
 		  hb_array_t<const unsigned int> component_count_list,
@@ -1320,7 +1320,7 @@
 
   bool serialize_single (hb_serialize_context_t *c,
 			 uint32_t lookup_props,
-		         hb_array_t<const GlyphID> glyphs,
+		         hb_sorted_array_t<const GlyphID> glyphs,
 		         hb_array_t<const GlyphID> substitutes)
   {
     TRACE_SERIALIZE (this);
@@ -1330,7 +1330,7 @@
 
   bool serialize_multiple (hb_serialize_context_t *c,
 			   uint32_t lookup_props,
-			   hb_array_t<const GlyphID> glyphs,
+			   hb_sorted_array_t<const GlyphID> glyphs,
 			   hb_array_t<const unsigned int> substitute_len_list,
 			   hb_array_t<const GlyphID> substitute_glyphs_list)
   {
@@ -1344,7 +1344,7 @@
 
   bool serialize_alternate (hb_serialize_context_t *c,
 			    uint32_t lookup_props,
-			    hb_array_t<const GlyphID> glyphs,
+			    hb_sorted_array_t<const GlyphID> glyphs,
 			    hb_array_t<const unsigned int> alternate_len_list,
 			    hb_array_t<const GlyphID> alternate_glyphs_list)
   {
@@ -1358,7 +1358,7 @@
 
   bool serialize_ligature (hb_serialize_context_t *c,
 			   uint32_t lookup_props,
-			   hb_array_t<const GlyphID> first_glyphs,
+			   hb_sorted_array_t<const GlyphID> first_glyphs,
 			   hb_array_t<const unsigned int> ligature_per_first_glyph_count_list,
 			   hb_array_t<const GlyphID> ligatures_list,
 			   hb_array_t<const unsigned int> component_count_list,