title: boost::optional vs std::optional for non copyable objects
body: <p>I tried to update from VS2015 to VS2017 and the code below does not work in the newer version. As you can see a move constructor is defined which automatically deletes the copy constructor. </p>
  
  <pre><code>#include &lt;boost/optional.hpp&gt;
  #include &lt;vector&gt;
  
  struct Foo {
      Foo() {}
      Foo(Foo&amp;&amp; other) {}
  };
  
  int main() {
      std::vector&lt;boost::optional&lt;Foo&gt;&gt; foos;
      foos.resize(42);
      return 0;
  }
  </code></pre>
  
  <p>The compilation error is </p>
  
  <pre><code>1&gt;...\boost\dist\include\boost-1_66\boost\optional\optional.hpp(384): error C2280: 'Foo::Foo(const Foo &amp;)': attempting to reference a deleted function
  1&gt;...\main.cpp(7): note: compiler has generated 'Foo::Foo' here
  1&gt;...\boost\dist\include\boost-1_66\boost\optional\optional.hpp(383): note: while compiling class template member function 'void boost::optional_detail::optional_base&lt;T&gt;::construct(const Foo &amp;)'
  1&gt;        with
  1&gt;        [
  1&gt;            T=Foo
  1&gt;        ]
  1&gt;...\boost\dist\include\boost-1_66\boost\optional\optional.hpp(181): note: see reference to function template instantiation 'void boost::optional_detail::optional_base&lt;T&gt;::construct(const Foo &amp;)' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            T=Foo
  1&gt;        ]
  1&gt;...\boost\dist\include\boost-1_66\boost\optional\optional.hpp(831): note: see reference to class template instantiation 'boost::optional_detail::optional_base&lt;T&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            T=Foo
  1&gt;        ]
  1&gt;...\msvc\14.12.25827\include\vector(1902): note: see reference to class template instantiation 'boost::optional&lt;Foo&gt;' being compiled
  1&gt;...\msvc\14.12.25827\include\vector(1901): note: while compiling class template member function 'boost::optional&lt;Foo&gt; *std::vector&lt;boost::optional&lt;Foo&gt;,std::allocator&lt;_Ty&gt;&gt;::_Udefault(boost::optional&lt;Foo&gt; *,const unsigned __int64)'
  1&gt;        with
  1&gt;        [
  1&gt;            _Ty=boost::optional&lt;Foo&gt;
  1&gt;        ]
  1&gt;...\msvc\14.12.25827\include\vector(1528): note: see reference to function template instantiation 'boost::optional&lt;Foo&gt; *std::vector&lt;boost::optional&lt;Foo&gt;,std::allocator&lt;_Ty&gt;&gt;::_Udefault(boost::optional&lt;Foo&gt; *,const unsigned __int64)' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            _Ty=boost::optional&lt;Foo&gt;
  1&gt;        ]
  1&gt;...\main.cpp(10): note: see reference to class template instantiation 'std::vector&lt;boost::optional&lt;Foo&gt;,std::allocator&lt;_Ty&gt;&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            _Ty=boost::optional&lt;Foo&gt;
  1&gt;        ]
  1&gt;...\main.cpp(7): note: 'Foo::Foo(const Foo &amp;)': function was implicitly deleted because 'Foo' has a user-defined move constructor
  </code></pre>
  
  <p>Now the interesting thing is that it does compile when I use <code>std::optional</code> instead of <code>boost::optional</code>. I am not really sure what the issue is and who to blame: me, boost, microsoft, the c++ standard? Anyone knows what is going on?</p>
  
  <p>Is this a known issue? Is it a bug in boost or is it correct that it does not work?</p>