title: Is it standard C++ to call move() with an output iterator that has been moved previously?
body: <p>While brushing up on algorithm design and learning C++11 at the same time, I came up with the following implementation for heap sort:</p>
  
  <blockquote>
  <pre><code>template &lt;typename It, typename Comp&gt;
  void heapSort(It begin, It end, Comp compFunc, std::random_access_iterator_tag)
  {
      std::make_heap(begin, end, compFunc);
      std::sort_heap(begin, end, compFunc);
  }
  
  template &lt;typename It, typename Comp, typename IterCat&gt;
  void heapSort(It begin, It end, Comp compFunc, IterCat)
  {
      typedef typename It::value_type value_type;
  
      std::vector&lt;value_type&gt; randomAccessContainer;
      randomAccessContainer.reserve(std::distance(begin, end));
      std::move(begin, end, std::back_inserter(randomAccessContainer));
  
      heapSort(std::begin(randomAccessContainer), std::end(randomAccessContainer), compFunc, std::random_access_iterator_tag());
      std::move(std::begin(randomAccessContainer), std::end(randomAccessContainer), begin);
  }
  </code></pre>
  </blockquote>
  
  <p>Is it standard C++ to first move from <code>[begin, end)</code> into a new container, and then move from that container back into <code>[begin, end)</code>?</p>