Boost C++ Libraries: Ticket #10003: Fibonacci heaps base class not copy constructible. https://svn.boost.org/trac10/ticket/10003 <p> The following code does not compile on Windows / Visual Express 2013 x64. </p> <div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre><span class="n">BOOST_AUTO_TEST_CASE</span><span class="p">(</span><span class="n">test_heap_vector</span><span class="p">)</span> <span class="p">{</span> <span class="k">typedef</span> <span class="n">boost</span><span class="o">::</span><span class="n">heap</span><span class="o">::</span><span class="n">fibonacci_heap</span><span class="o">&lt;</span><span class="kt">double</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">heap</span><span class="o">::</span><span class="n">compare</span><span class="o">&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">less</span><span class="o">&lt;</span><span class="kt">double</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="o">&gt;</span> <span class="n">low_heap_t</span><span class="p">;</span> <span class="n">low_heap_t</span> <span class="n">lowh</span><span class="p">;</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">K</span> <span class="o">=</span> <span class="mi">7</span><span class="p">;</span> <span class="n">boost</span><span class="o">::</span><span class="n">random</span><span class="o">::</span><span class="n">uniform_real_distribution</span><span class="o">&lt;</span><span class="kt">double</span><span class="o">&gt;</span> <span class="n">dist</span><span class="p">;</span> <span class="c1">// preparing the heap</span> <span class="k">for</span><span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">100</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="kt">double</span> <span class="n">current</span> <span class="o">=</span> <span class="n">dist</span><span class="p">(</span><span class="n">rng</span><span class="p">);</span> <span class="k">if</span><span class="p">(</span><span class="n">lowh</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">&lt;</span> <span class="n">K</span><span class="p">)</span> <span class="p">{</span> <span class="n">lowh</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">current</span><span class="p">);</span> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span><span class="p">(</span><span class="n">lowh</span><span class="p">.</span><span class="n">value_comp</span><span class="p">()(</span><span class="n">current</span><span class="p">,</span> <span class="n">lowh</span><span class="p">.</span><span class="n">top</span><span class="p">()))</span> <span class="p">{</span> <span class="n">lowh</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">current</span><span class="p">);</span> <span class="n">lowh</span><span class="p">.</span><span class="n">pop</span><span class="p">();</span> <span class="p">}</span> <span class="p">}</span> <span class="n">BOOST_CHECK_EQUAL</span><span class="p">(</span><span class="n">lowh</span><span class="p">.</span><span class="n">size</span><span class="p">(),</span> <span class="n">K</span><span class="p">);</span> <span class="c1">// duplicating in the vector</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">low_heap_t</span><span class="o">&gt;</span> <span class="n">v</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">lowh</span><span class="p">);</span> <span class="k">for</span><span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="n">BOOST_CHECK_EQUAL</span><span class="p">(</span><span class="n">v</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">size</span><span class="p">(),</span> <span class="n">K</span><span class="p">);</span> <span class="p">}</span> <span class="p">}</span> </pre></div></div></div><p> The compiler gives me this: </p> <pre class="wiki">1&gt;d:\Code\thirdparties\visual2013x64\boost_1_55\include\boost-1_55\boost/heap/fibonacci_heap.hpp(224): error C2664: 'boost::heap::detail::make_fibonacci_heap_base&lt;T,boost::parameter::aux::arg_list&lt;boost::heap::compare&lt;std::less&lt;double&gt;&gt;,ArgumentPack&gt;&gt;::type::type(boost::heap::detail::make_fibonacci_heap_base&lt;T,boost::parameter::aux::arg_list&lt;boost::heap::compare&lt;std::less&lt;double&gt;&gt;,ArgumentPack&gt;&gt;::type &amp;)' : impossible de convertir l'argument 1 de 'const boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt;' en 'const std::less&lt;double&gt; &amp;' 1&gt; with 1&gt; [ 1&gt; T=double 1&gt; , ArgumentPack=boost::parameter::aux::empty_arg_list 1&gt; ] 1&gt; Raison : impossible de convertir de 'const boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt;' en 'const std::less&lt;double&gt;' 1&gt; Aucun opérateur de conversion définie par l'utilisateur disponible qui puisse effectuer cette conversion, ou l'opérateur ne peut pas être appelé 1&gt; d:\Code\thirdparties\visual2013x64\boost_1_55\include\boost-1_55\boost/heap/fibonacci_heap.hpp(222) : lors de la compilation de la fonction membre 'boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt;::fibonacci_heap(const boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt; &amp;)' de la classe modèle 1&gt; C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(593) : voir la référence à l'instanciation de la fonction modèle 'boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt;::fibonacci_heap(const boost::heap::fibonacci_heap&lt;double,boost::heap::compare&lt;std::less&lt;double&gt;&gt;,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_&gt; &amp;)' en cours de compilation ========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ========== </pre><p> Apparently it comes from </p> <div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre> <span class="n">make_fibonacci_heap_base</span><span class="o">::</span><span class="n">type</span> </pre></div></div></div><p> Creating a copy constructor and moving the assignment operator out of the #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES / #endif seems to work. </p> <div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre> <span class="k">struct</span> <span class="nl">type</span><span class="p">:</span> <span class="n">base_type</span><span class="p">,</span> <span class="n">allocator_type</span> <span class="p">{</span> <span class="n">type</span><span class="p">(</span><span class="n">compare_argument</span> <span class="k">const</span> <span class="o">&amp;</span> <span class="n">arg</span><span class="p">)</span><span class="o">:</span> <span class="n">base_type</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="p">{}</span> <span class="n">type</span><span class="p">(</span><span class="n">type</span> <span class="k">const</span> <span class="o">&amp;</span> <span class="n">rhs</span><span class="p">)</span><span class="o">:</span> <span class="n">base_type</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">base_type</span> <span class="k">const</span> <span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">)),</span> <span class="n">allocator_type</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">allocator_type</span> <span class="k">const</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">))</span> <span class="p">{}</span> <span class="cp">#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES</span> <span class="n">type</span><span class="p">(</span><span class="n">type</span> <span class="o">&amp;&amp;</span> <span class="n">rhs</span><span class="p">)</span><span class="o">:</span> <span class="n">base_type</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">base_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">))),</span> <span class="n">allocator_type</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">allocator_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">)))</span> <span class="p">{}</span> <span class="n">type</span><span class="p">(</span><span class="n">type</span> <span class="o">&amp;</span> <span class="n">rhs</span><span class="p">)</span><span class="o">:</span> <span class="n">base_type</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">base_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">)),</span> <span class="n">allocator_type</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">allocator_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">))</span> <span class="p">{}</span> <span class="n">type</span> <span class="o">&amp;</span> <span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="n">type</span> <span class="o">&amp;&amp;</span> <span class="n">rhs</span><span class="p">)</span> <span class="p">{</span> <span class="n">base_type</span><span class="o">::</span><span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">base_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">)));</span> <span class="n">allocator_type</span><span class="o">::</span><span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">allocator_type</span><span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">)));</span> <span class="k">return</span> <span class="o">*</span><span class="k">this</span><span class="p">;</span> <span class="p">}</span> <span class="cp">#endif</span> <span class="n">type</span> <span class="o">&amp;</span> <span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="n">type</span> <span class="k">const</span> <span class="o">&amp;</span> <span class="n">rhs</span><span class="p">)</span> <span class="p">{</span> <span class="n">base_type</span><span class="o">::</span><span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">base_type</span> <span class="k">const</span> <span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">));</span> <span class="n">allocator_type</span><span class="o">::</span><span class="k">operator</span><span class="o">=</span><span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="n">allocator_type</span> <span class="k">const</span> <span class="o">&amp;&gt;</span><span class="p">(</span><span class="n">rhs</span><span class="p">));</span> <span class="k">return</span> <span class="o">*</span><span class="k">this</span><span class="p">;</span> <span class="p">}</span> <span class="p">};</span> </pre></div></div></div> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10003 Trac 1.4.3 Raffi Enficiaud Sat, 03 May 2014 12:53:38 GMT cc set https://svn.boost.org/trac10/ticket/10003#comment:1 https://svn.boost.org/trac10/ticket/10003#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">raffi.enficiaud@…</span> added </li> </ul> Ticket timblechmann Sat, 03 May 2014 18:21:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10003#comment:2 https://svn.boost.org/trac10/ticket/10003#comment:2 <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> <p> fixed in develop! </p> Ticket