Boost C++ Libraries: Ticket #1785: assign::list_of works poorly with class constructors https://svn.boost.org/trac10/ticket/1785 <p> try compiling the following snippet: </p> <blockquote> <p> #include &lt;boost/assign/list_of.hpp&gt; using namespace boost::assign; </p> </blockquote> <p> </p> <blockquote> <p> class foo { public: </p> <blockquote> <p> foo(const vector&lt;int&gt;&amp; a) {} </p> </blockquote> <p> }; </p> </blockquote> <p> </p> <blockquote> <p> void bar() { </p> <blockquote> <p> foo a(list_of(0)); </p> </blockquote> <p> } </p> </blockquote> <p> at the line 'foo a(list_of(0))' the compiler (VC8) thinks I want to call the copy contructor of foo, instead of the constructor that would cause a conversion to vector&lt;int&gt;. This case requires an explicit conversion, or using a different constructor prototype that doesn't overload the copy constructor. </p> <p> Please, advise which is the best way to use list_of in this scenario. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1785 Trac 1.4.3 Thorsten Ottosen Thu, 12 Jun 2008 10:59:47 GMT status changed https://svn.boost.org/trac10/ticket/1785#comment:1 https://svn.boost.org/trac10/ticket/1785#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Does </p> <blockquote> <p> foo a((vector&lt;int&gt;)list_of(0)); </p> </blockquote> <p> not work? </p> <p> -Thorsten </p> Ticket Thorsten Ottosen Thu, 31 Mar 2011 20:25:44 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1785#comment:2 https://svn.boost.org/trac10/ticket/1785#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket