title: boost::filesystem::directory_iterator copy-ctor implictly deleted
body: <p>The <a href="http://www.boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/reference.html#Class-directory_iterator" rel="nofollow"><code>boost::filesystem::directory_iterator</code> reference</a> (v1.48) says <code>directory_iterator</code> defines a copy constructor explicitly. I just looked at <a href="http://www.boost.org/doc/libs/1_48_0/boost/filesystem/v3/operations.hpp" rel="nofollow">the code</a> and it doesn't, presumably letting the compiler define the copy-ctor.</p>
  
  <p>Can a situation happen where the compiler generates a move-ctor for the type, subsequently figure that the implicit copy-ctor would be ill-formed and thus delete the copy-ctor? I haven't yet reproduced it in a simple and concise code snippet, but it seems to be what's going on in my code right now with a gcc 4.7 snapshot from 2011-12-17. I don't have the issue in gcc 4.6.1 though.</p>
  
  <p>Here's a taste of the error from gcc 4.7:</p>
  
  <pre><code>In file included from /usr/local/include/boost/iterator/interoperable.hpp:13:0,
                   from /usr/local/include/boost/iterator/iterator_facade.hpp:11,
                   from /usr/local/include/boost/filesystem/v3/path.hpp:28,
                   from /usr/local/include/boost/filesystem/path.hpp:31,
                   from /Users/matan/Development/ouch.git/src/include/ouch/operations.hh:4,
                   from /Users/matan/Development/ouch.git/src/libouch/operations.cc:1:
  /usr/local/include/boost/type_traits/is_convertible.hpp: In instantiation of 'const bool boost::detail::is_convertible_basic_impl&lt;boost::filesystem3::directory_iterator&amp;, boost::filesystem3::directory_iterator&gt;::value':
  /usr/local/include/boost/type_traits/is_convertible.hpp:296:272:   required from 'const bool boost::detail::is_convertible_impl&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;::value'
  /usr/local/include/boost/type_traits/is_convertible.hpp:419:47:   required from 'struct boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;'
  /usr/local/include/boost/mpl/aux_/nested_type_wknd.hpp:26:31:   required from 'struct boost::mpl::aux::nested_type_wknd&lt;boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt; &gt;'
  /usr/local/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:48:8:   required from 'struct boost::mpl::or_&lt;boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;, boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;, mpl_::bool_&lt;false&gt;, mpl_::bool_&lt;false&gt;, mpl_::bool_&lt;false&gt; &gt;'
  /usr/local/include/boost/iterator/detail/enable_if.hpp:68:12:   required from 'struct boost::iterators::enable_if&lt;boost::mpl::or_&lt;boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;, boost::is_convertible&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator&gt;, mpl_::bool_&lt;false&gt;, mpl_::bool_&lt;false&gt;, mpl_::bool_&lt;false&gt; &gt;, bool&gt;'
  /usr/local/include/boost/iterator/iterator_facade.hpp:67:12:   required from 'struct boost::detail::enable_if_interoperable&lt;boost::filesystem3::directory_iterator, boost::filesystem3::directory_iterator, bool&gt;'
  /usr/local/include/boost/iterator/iterator_facade.hpp:837:323:   required by substitution of 'template&lt;class Derived1, class V1, class TC1, class Reference1, class Difference1, class Derived2, class V2, class TC2, class Reference2, class Difference2&gt; typename boost::detail::enable_if_interoperable&lt;Derived1, Derived2, typename boost::mpl::apply2&lt;boost::detail::always_bool2, Derived1, Derived2&gt;::type&gt;::type boost::operator!=(const boost::iterator_facade&lt;Derived1, V1, TC1, Reference1, Difference1&gt;&amp;, const boost::iterator_facade&lt;Derived2, V2, TC2, Reference2, Difference2&gt;&amp;) [with Derived1 = boost::filesystem3::directory_iterator; V1 = boost::filesystem3::directory_entry; TC1 = boost::single_pass_traversal_tag; Reference1 = boost::filesystem3::directory_entry&amp;; Difference1 = long int; Derived2 = boost::filesystem3::directory_iterator; V2 = boost::filesystem3::directory_entry; TC2 = boost::single_pass_traversal_tag; Reference2 = boost::filesystem3::directory_entry&amp;; Difference2 = long int]'
  /usr/local/include/boost/filesystem/v3/operations.hpp:691:49:   required from here
  /usr/local/include/boost/type_traits/is_convertible.hpp:137:49: error: use of deleted function 'boost::filesystem3::directory_iterator::directory_iterator(const boost::filesystem3::directory_iterator&amp;)'
  In file included from /usr/local/include/boost/filesystem/operations.hpp:31:0,
                   from /Users/matan/Development/ouch.git/src/libouch/operations.cc:4:
  /usr/local/include/boost/filesystem/v3/operations.hpp:581:9: note: 'boost::filesystem3::directory_iterator::directory_iterator(const boost::filesystem3::directory_iterator&amp;)' is implicitly deleted because the default definition would be ill-formed:
  /usr/local/include/boost/filesystem/v3/operations.hpp:581:9: error: use of deleted function 'boost::shared_ptr&lt;boost::filesystem3::detail::dir_itr_imp&gt;::shared_ptr(const boost::shared_ptr&lt;boost::filesystem3::detail::dir_itr_imp&gt;&amp;)'
  </code></pre>