Boost C++ Libraries: Ticket #12423: fusion::make_map breaks when passing references https://svn.boost.org/trac10/ticket/12423 <p> When using variadic maps the following code doesn't compile: </p> <pre class="wiki">int i = 0; fusion::make_map&lt;int&gt;(ref(i)); </pre><p> Clang gives this error: error : no matching constructor for initialization of 'detail::map_impl&lt;0, pair&lt;int, int &amp;&gt; &gt;' 1&gt; : base_type(first, rest...) 1&gt; <sup> <del></del>~ </sup></p> <p> There is a constructor in fusion::pair that can do the required conversion: </p> <pre class="wiki"> template &lt;typename Second2&gt; BOOST_FUSION_GPU_ENABLED pair(Second2&amp;&amp; val , typename boost::disable_if&lt;is_lvalue_reference&lt;Second2&gt; &gt;::type* /* dummy */ = 0 , typename boost::enable_if&lt;is_convertible&lt;Second2, Second&gt; &gt;::type* /*dummy*/ = 0 ) : second(BOOST_FUSION_FWD_ELEM(Second, val)) {} </pre><p> But it's not being invoked since there's no make_map function that takes rvalue refs. I was able to make this work by adding another make_map overload: </p> <pre class="wiki"> template &lt;typename ...Key, typename ...T&gt; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline map&lt; fusion::pair&lt; Key , typename detail::as_fusion_element&lt;T&gt;::type &gt;...&gt; make_map(T &amp;&amp;... arg) { typedef map&lt; fusion::pair&lt; Key , typename detail::as_fusion_element&lt;T&gt;::type &gt;...&gt; result_type; return result_type(std::forward&lt;T&gt;(arg)...); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12423 Trac 1.4.3 Joel de Guzman Tue, 30 Aug 2016 17:28:45 GMT <link>https://svn.boost.org/trac10/ticket/12423#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12423#comment:1</guid> <description> <p> Could you please prepare a PR for this? Thanks! </p> </description> <category>Ticket</category> </item> </channel> </rss>