     var count: Index.Distance = 0
     while start != end {
       ++count
-      start = next(start)
+      _nextInPlace(&start)
     }
     return count
   }

}

/*
public protocol MyBidirectionalIndexType : MyForwardIndexType {
  @warn_unused_result
  func predecessor() -> Self

  mutating func _predecessorInPlace()
}
extension MyBidirectionalIndexType {
  @inline(__always)
  public mutating func _predecessorInPlace() {
    self = self.predecessor()
  }

  @warn_unused_result
  public func advancedBy(n: Distance) -> Self {
    if n >= 0 {
      return _advanceForward(n)
    }
    var p = self
    for var i: Distance = n; i != 0; ++i {
      --p
    }
    return p
  }

  @warn_unused_result
  public func advancedBy(n: Distance, limit: Self) -> Self {
    if n >= 0 {
      return _advanceForward(n, limit)
    }
    var p = self
    for var i: Distance = n; i != 0 && p != limit; ++i {
      --p
    }
    return p
  }
}

public protocol MyRandomAccessIndexType : MyBidirectionalIndexType, MyStrideable,
  _RandomAccessAmbiguity {


    return _elements[i]
  }
}

//------------------------------------------------------------------------
// Simplest Forward Collection

public struct MySimplestForwardCollection<Element> : MyForwardCollectionType {
  internal let _elements: [Element]

  public init(_ elements: [Element]) {
    self._elements = elements
  }

  public var startIndex: MySimplestForwardCollectionIndex {
    return MySimplestForwardCollectionIndex(_elements.startIndex)
  }

  public var endIndex: MySimplestForwardCollectionIndex {
    return MySimplestForwardCollectionIndex(_elements.endIndex)
  }

  @warn_unused_result
  public func next(i: MySimplestForwardCollectionIndex) -> MySimplestForwardCollectionIndex {
    return MySimplestForwardCollectionIndex(i._index + 1)
  }

  public subscript(i: MySimplestForwardCollectionIndex) -> Element {
    return _elements[i._index]
  }
}

public struct MySimplestForwardCollectionIndex : MyIndexType {
  internal let _index: Int
  internal init(_ index: Int) {
    self._index = index
  }
}

public func == (
  lhs: MySimplestForwardCollectionIndex,
  rhs: MySimplestForwardCollectionIndex
) -> Bool {
  return lhs._index == rhs._index
}

//------------------------------------------------------------------------
// Simplest Bidirectional Collection

public struct MySimplestBidirectionalCollection<Element> : MyBidirectionalCollectionType {
  internal let _elements: [Element]

  public init(_ elements: [Element]) {
    self._elements = elements
  }

  public var startIndex: MySimplestBidirectionalCollectionIndex {
    return MySimplestBidirectionalCollectionIndex(_elements.startIndex)
  }

  public var endIndex: MySimplestBidirectionalCollectionIndex {
    return MySimplestBidirectionalCollectionIndex(_elements.endIndex)
  }

  @warn_unused_result
  public func next(i: MySimplestBidirectionalCollectionIndex) -> MySimplestBidirectionalCollectionIndex {
    return MySimplestBidirectionalCollectionIndex(i._index + 1)
  }

  @warn_unused_result
  public func previous(i: MySimplestBidirectionalCollectionIndex) -> MySimplestBidirectionalCollectionIndex {
    return MySimplestBidirectionalCollectionIndex(i._index - 1)
  }

  public subscript(i: MySimplestBidirectionalCollectionIndex) -> Element {
    return _elements[i._index]
  }
}

public struct MySimplestBidirectionalCollectionIndex : MyIndexType {
  internal let _index: Int
  internal init(_ index: Int) {
    self._index = index
  }
}

public func == (
  lhs: MySimplestBidirectionalCollectionIndex,
  rhs: MySimplestBidirectionalCollectionIndex
) -> Bool {
  return lhs._index == rhs._index
}

//------------------------------------------------------------------------
// Simplest Bidirectional Collection

public struct MySimplestRandomAccessCollection<Element> : MyRandomAccessCollectionType {
  internal let _elements: [Element]

  public init(_ elements: [Element]) {
    self._elements = elements
  }

  // FIXME: 'typealias Index' should be inferred.
  public typealias Index = MySimplestRandomAccessCollectionIndex

  public var startIndex: MySimplestRandomAccessCollectionIndex {
    return MySimplestRandomAccessCollectionIndex(_elements.startIndex)
  }

  public var endIndex: MySimplestRandomAccessCollectionIndex {
    return MySimplestRandomAccessCollectionIndex(_elements.endIndex)
  }

  public subscript(i: MySimplestRandomAccessCollectionIndex) -> Element {
    return _elements[i._index]
  }
}

public struct MySimplestRandomAccessCollectionIndex : MyRandomAccessIndex {
  internal let _index: Int
  internal init(_ index: Int) {
    self._index = index
  }

  @warn_unused_result
  public func distanceTo(other: MySimplestRandomAccessCollectionIndex) -> Int {
    return other._index - _index
  }

  @warn_unused_result
  public func advancedBy(n: Int) -> MySimplestRandomAccessCollectionIndex {
    return MySimplestRandomAccessCollectionIndex(_index + n)
  }
}

public func == (
  lhs: MySimplestRandomAccessCollectionIndex,
  rhs: MySimplestRandomAccessCollectionIndex
) -> Bool {
  return lhs._index == rhs._index
}

public func < (
  lhs: MySimplestRandomAccessCollectionIndex,
  rhs: MySimplestRandomAccessCollectionIndex
) -> Bool {
  return lhs._index < rhs._index
}

//------------------------------------------------------------------------

// FIXME: how does AnyCollection look like in the new scheme?

