title: Using std::copy on random access memory iterators
body: <p>I am in the middle of a migration process from VS2008 to VS2013 and I receive an error on the following line which used to compile fine in VS2008:</p>
  
  <pre><code>std::copy(inIterator, inIterator + size , stdext::checked_array_iterator&lt;T::ImgIterator&gt;(outIterator, size)) ;
  </code></pre>
  
  <p>in inIterator, outIterator and ImgIterator are all defined as <code>random_access_iterator_tag</code> type iterators.</p>
  
  <p>The error which I receive is:</p>
  
  <pre><code>error C2665: 'std::_Copy_impl' : none of the 2 overloads could convert all the argument types
  </code></pre>
  
  <p>I believe the problem is with the iterator types but I am not sure exactly what is the problem or how to fix it (without changing the iterator debug level). </p>
  
  <p>EDIT2: const_ImgIterator is defined as follows:</p>
  
  <pre><code>class ImgIterator : public _Ranit&lt;T,difference_type,pointer,reference&gt; {
  </code></pre>
  
  <p>and _Ranit is defined in xutility:</p>
  
  <pre><code>template&lt;class _Ty,
  class _Diff,
  class _Pointer,
  class _Reference&gt;
  struct _Ranit
      : public _Iterator_with_base&lt;random_access_iterator_tag,
          _Ty, _Diff, _Pointer, _Reference&gt;
  {   // base type for container random-access iterator classes
  };
  </code></pre>
  
  <p>EDIT: added the build output:</p>
  
  <pre><code>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2107): error C2665: 'std::_Copy_impl' : none of the 2 overloads could convert all the argument types
            c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2092): could be '_OutIt std::_Copy_impl&lt;_InIt,_OutIt&gt;(_InIt,_InIt,_OutIt,std::random_access_iterator_tag,std::random_access_iterator_tag)'
            with
            [
                _OutIt=stdext::checked_array_iterator&lt;CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::ImgIterator&gt;
    ,            _InIt=CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::const_ImgIterator
            ]
            c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2083): or       '_OutIt std::_Copy_impl&lt;_InIt,_OutIt&gt;(_InIt,_InIt,_OutIt,std::input_iterator_tag,std::_Mutable_iterator_tag)'
            with
            [
                _OutIt=stdext::checked_array_iterator&lt;CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::ImgIterator&gt;
    ,            _InIt=CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::const_ImgIterator
            ]
            while trying to match the argument list '(CImg&lt;unsigned char,std::allocator&lt;T&gt;&gt;::const_ImgIterator, CImg&lt;unsigned char,std::allocator&lt;T&gt;&gt;::const_ImgIterator, stdext::checked_array_iterator&lt;CImg&lt;unsigned char,std::allocator&lt;T&gt;&gt;::ImgIterator&gt;, std::input_iterator_tag, std::input_iterator_tag)'
            with
            [
                T=unsigned char
            ]
            c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2132) : see reference to function template instantiation '_OutIt std::_Copy_impl&lt;_Iter,_OutIt&gt;(_InIt,_InIt,_OutIt,std::true_type)' being compiled
            with
            [
                _OutIt=stdext::checked_array_iterator&lt;CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::ImgIterator&gt;
    ,            _Iter=CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::const_ImgIterator
    ,            _InIt=CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::const_ImgIterator
            ]
            q:\airi\images\img_alg.h(298) : see reference to function template instantiation '_OutIt std::copy&lt;CImg&lt;unsigned char,std::allocator&lt;T&gt;&gt;::const_ImgIterator,stdext::checked_array_iterator&lt;CImg&lt;T,std::allocator&lt;T&gt;&gt;::ImgIterator&gt;&gt;(_InIt,_InIt,_OutIt)' being compiled
            with
            [
                _OutIt=stdext::checked_array_iterator&lt;CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::ImgIterator&gt;
    ,            T=unsigned char
    ,            _InIt=CImg&lt;unsigned char,std::allocator&lt;unsigned char&gt;&gt;::const_ImgIterator
            ]
            q:\airi\images_mil_part\img_alg_mil.cpp(182) : see reference to function template instantiation 'void ImgAlg::Window&lt;CImgAlgMil::CByteImg&gt;(const T &amp;,T &amp;,const CPixelWindow &amp;)' being compiled
            with
            [
                T=CImgAlgMil::CByteImg
            ]
  </code></pre>