Boost C++ Libraries: Ticket #12087: transform_iterator is not assignable in VS2015 https://svn.boost.org/trac10/ticket/12087 <p> The following code does not compile in Visual Studio 2015 because the assignment operator of transform_iterator seems to be deleted: </p> <p> #include "boost/iterator/transform_iterator.hpp" #include &lt;vector&gt; int main() { </p> <blockquote> <p> auto v = std::vector&lt;int&gt;{}; auto it = boost::make_transform_iterator(std::begin(v), [](int) { return 1; }); </p> </blockquote> <blockquote> <p> it = it; </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> The line 'it = it' is the culprit, giving error C2280: 'boost::iterators::transform_iterator&lt;main::&lt;lambda_245a5d22fdccfa4a35ac6bb4a4dc8307&gt;,std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;int&gt;&gt;&gt;,boost::iterators::use_default,boost::iterators::use_default&gt; &amp;boost::iterators::transform_iterator&lt;main::&lt;lambda_245a5d22fdccfa4a35ac6bb4a4dc8307&gt;,std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;int&gt;&gt;&gt;,boost::iterators::use_default,boost::iterators::use_default&gt;::operator =(const boost::iterators::transform_iterator&lt;main::&lt;lambda_245a5d22fdccfa4a35ac6bb4a4dc8307&gt;,std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;int&gt;&gt;&gt;,boost::iterators::use_default,boost::iterators::use_default&gt; &amp;)': attempting to reference a deleted function boost\iterator\transform_iterator.hpp(127): note: compiler has generated 'boost::iterators::transform_iterator&lt;main::&lt;lambda_245a5d22fdccfa4a35ac6bb4a4dc8307&gt;,std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;int&gt;&gt;&gt;,boost::iterators::use_default,boost::iterators::use_default&gt;::operator =' here </p> <p> I assume iterators need to be assignable. Furthermore I see no reason why the compiler wouldn't generate the standard member functions. Everything compiles OK in VS2013. </p> <p> Thanks in advance for having a look. Regards, Ben </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12087 Trac 1.4.3 Steven Watanabe Tue, 22 Mar 2016 15:46:38 GMT <link>https://svn.boost.org/trac10/ticket/12087#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12087#comment:1</guid> <description> <p> The problem is that assignment of transform_iterator requires the function object to be assignable. </p> <p> "The closure type associated with a lambda-expression has a deleted (8.4.3) default constructor and a deleted copy assignment operator." [expr.prim.lambda] </p> </description> <category>Ticket</category> </item> <item> <author>bswerts@…</author> <pubDate>Tue, 22 Mar 2016 16:59:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12087#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12087#comment:2</guid> <description> <p> Thanks for the quick and precise answer, Steven. VS2015 is indeed adhering better to the standard. I know now how to fix my code. This issue can be closed. Sorry for the noise. </p> </description> <category>Ticket</category> </item> </channel> </rss>