Boost C++ Libraries: Ticket #10834: ptr_array cannot be used with boost::nullable<T> as type parameter https://svn.boost.org/trac10/ticket/10834 <p> The copy constructor of ptr_array uses operator[] to access the elements of the ptr_array to copy.<br /> Problem one: It is not save to call ptr_array[i] if element i is null.<br /> Problem two: Operator[] returns a reference to remove_nullable&lt;T&gt;::type. The address of this object is then casted to const T*, which fails with compilation error C2664 if T=nullable&lt;X&gt;, because X* cannot be casted to nullable&lt;X&gt;*. </p> <p> Reproduction: compile attached test.cpp<br /> Possible fix: see attached patch<br /> <br /> Regards, Florian </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10834 Trac 1.4.3 florian.schmid1978@… Tue, 02 Dec 2014 09:47:04 GMT attachment set https://svn.boost.org/trac10/ticket/10834 https://svn.boost.org/trac10/ticket/10834 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ptr_array.zip</span> </li> </ul> Ticket florian.schmid1978@… Tue, 02 Dec 2014 09:52:53 GMT attachment set https://svn.boost.org/trac10/ticket/10834 https://svn.boost.org/trac10/ticket/10834 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ptr_array2.zip</span> </li> </ul> Ticket florian.schmid1978@… Tue, 02 Dec 2014 09:54:07 GMT <link>https://svn.boost.org/trac10/ticket/10834#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10834#comment:1</guid> <description> <p> The patch in ptr_array.zip is broken, please use the one in ptr_array2.zip. </p> </description> <category>Ticket</category> </item> </channel> </rss>