Boost C++ Libraries: Ticket #10844: flyweight: multiple default constructors with real perfect forwarding https://svn.boost.org/trac10/ticket/10844 <p> Flyweight gets two default constructors, since it has a direct default constructor </p> <pre class="wiki"> flyweight():h(core::insert()){} </pre><p> and one based on variable template arguments, which can be zero. </p> <pre class="wiki"> #define BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY(args) \ :h(core::insert(BOOST_FLYWEIGHT_FORWARD(args))){} BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS( explicit flyweight, BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY) #undef BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY </pre><p> which can expand to: </p> <pre class="wiki">template&lt;typename... Args&gt; explicit flyweight(Args&amp;&amp;... args) :h(core::insert(std::forward&lt;Args&gt;(args)...)){} </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10844 Trac 1.4.3 Joaquín M López Muñoz Thu, 04 Dec 2014 11:11:11 GMT <link>https://svn.boost.org/trac10/ticket/10844#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:1</guid> <description> <p> As far as I understand C++ rules, this should not raise any kind of ambiguity as the default ctor should be preferred over the templated ctor (called with no args). Are you having warnings with some compiler? </p> </description> <category>Ticket</category> </item> <item> <author>tore.halvorsen@…</author> <pubDate>Thu, 04 Dec 2014 11:19:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10844#comment:1" title="Comment 1">joaquin</a>: </p> <blockquote class="citation"> <p> As far as I understand C++ rules, this should not raise any kind of ambiguity as the default ctor should be preferred over the templated ctor (called with no args). Are you having warnings with some compiler? </p> </blockquote> <p> I get warnings from MS Visual Studio 2013. </p> <p> You are probably right in that the default ctor is preferred. It's probably just a cosmetic warning. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Thu, 04 Dec 2014 11:23:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:3</guid> <description> <p> OK, I'll fix it then tonight if I have a moment to spare. Can I count on your support to verify that the warning goes away after I do the commit? </p> </description> <category>Ticket</category> </item> <item> <author>tore.halvorsen@…</author> <pubDate>Thu, 04 Dec 2014 11:24:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10844#comment:3" title="Comment 3">joaquin</a>: </p> <blockquote class="citation"> <p> OK, I'll fix it then tonight if I have a moment to spare. Can I count on your support to verify that the warning goes away after I do the commit? </p> </blockquote> <p> Sure :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Thu, 04 Dec 2014 20:28:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:5</guid> <description> <p> Here you are: </p> <p> <a class="ext-link" href="https://github.com/boostorg/flyweight/commit/8f5bbd5d57780fd33e3b527a3d406e14a4d0fd9d"><span class="icon">​</span>https://github.com/boostorg/flyweight/commit/8f5bbd5d57780fd33e3b527a3d406e14a4d0fd9d</a> </p> <p> Could you please report back if the warning is gone? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Fri, 05 Dec 2014 07:14:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:6</guid> <description> <p> I've decided to revert the previous fix as it changes (theoretically at least) <code>boost::flyweight</code> public interface, and used <code>#pragma warning(disable:4520)</code> instead: </p> <p> <a class="ext-link" href="https://github.com/boostorg/flyweight/commit/095dcfb812ab8670af70912419e129d9ad656927"><span class="icon">​</span>https://github.com/boostorg/flyweight/commit/095dcfb812ab8670af70912419e129d9ad656927</a> </p> <p> Can you check this works also? Thank you. </p> </description> <category>Ticket</category> </item> <item> <author>tore.halvorsen@…</author> <pubDate>Fri, 05 Dec 2014 07:28:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:7</guid> <description> <p> The first worked - I'll check the second :) </p> </description> <category>Ticket</category> </item> <item> <author>tore.halvorsen@…</author> <pubDate>Fri, 05 Dec 2014 07:30:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10844#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10844#comment:8</guid> <description> <p> The pragma works as well. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Fri, 05 Dec 2014 07:36:16 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10844#comment:9 https://svn.boost.org/trac10/ticket/10844#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket