Boost C++ Libraries: Ticket #12292: [TypeErasure] Construction of any from static_binding fails if compiling with rvalue-ref support https://svn.boost.org/trac10/ticket/12292 <p> Although the documentation of <strong>Boost.Type<code></code>Erasure</strong> explicitly shows how to default-construct an <code>any</code><code></code> from the binding of another <code>any</code>, this seems not to work when rvalue-references are supported by the compiler. </p> <blockquote> <p> The reason is, that the wrong constructor overload is chosen. </p> </blockquote> <p> <code>binding_of</code><code></code> returns a <code>static_binding</code><code></code> for which no explicit <code>any</code>-constructor is available. If rvalue-references are not supported by the compiler the constructor-overload which takes a <code>binding</code><code></code> is chosen (due to implicit conversion from <code>static_binding</code><code></code> to <code>binding</code>). </p> <p> If rvalue-references are supported the constructor which takes a "universal reference" <code>[1]</code><code></code> is chosen instead which does not expect and therefore cannot handle the <code>static_binding</code>. </p> <p> <code>[1]</code> <a class="ext-link" href="https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers"><span class="icon">​</span>https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12292 Trac 1.4.3 Deniz Bahadir <D.Bahadir@…> Wed, 22 Jun 2016 11:06:50 GMT <link>https://svn.boost.org/trac10/ticket/12292#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12292#comment:1</guid> <description> <p> This pull-request <a class="ext-link" href="https://github.com/boostorg/type_erasure/pull/10"><span class="icon">​</span>https://github.com/boostorg/type_erasure/pull/10</a> fixes it. </p> </description> <category>Ticket</category> </item> <item> <author>Deniz Bahadir <D.Bahadir@…></author> <pubDate>Wed, 22 Jun 2016 11:41:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12292#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12292#comment:2</guid> <description> <p> I am sorry, I must correct some of my above mentioned explanations. </p> <p> <code>binding_of</code><code></code> does not return a <code>static_binding</code><code></code>, but a <code>binding</code><code></code>, for which <code>any</code>-constructors are available. </p> <p> However, <code>make_binding</code><code></code> returns a <code>static_binding</code><code></code> and I see no reason why creating an <code>any</code><code></code> with the help of <code>make_binding</code><code></code> should not succeed. So, the pull-request still keeps its relevance. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Wed, 22 Mar 2017 21:47:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12292#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12292#comment:3</guid> <description> <p> I intentionally didn't provide this constructor. I don't see any reasonable use case for it. Also, static_binding in general is not interchangeable with binding, so I don't think it's necessary to provide it for completeness. </p> </description> <category>Ticket</category> </item> </channel> </rss>