Boost C++ Libraries: Ticket #7358: typedef T in Comparison class clashes with template argument T in d_ary_heap https://svn.boost.org/trac10/ticket/7358 <p> The d_ary_heap does not compile (in VS2010) when the Comparison class contains a typedef T. The typedef takes prevalence over the template parameter T when the heap is derived from the Comparison class. </p> <p> I.e. the following pattern occurs: </p> <p> template&lt;class T, class Cmp&gt; struct heap_base : Cmp { </p> <blockquote> <p> typedef T value_type; <em> value_type = Cmp::T </em></p> </blockquote> <p> } </p> <p> See below for a complete failing example. </p> <p> This is a problem when Boost.Heap is used in combination with boost/pending/indirect_cmp.hpp. </p> <p> #include &lt;boost/heap/d_ary_heap.hpp&gt; </p> <p> struct less { </p> <blockquote> <p> typedef int T; bool operator()(const int&amp; a, const int&amp; b) const { </p> <blockquote> <p> return a &lt; b; </p> </blockquote> <p> } </p> </blockquote> <p> }; </p> <p> int main() { </p> <blockquote> <p> boost::heap::d_ary_heap&lt;int, boost::heap::compare&lt;less&gt;, boost::heap::arity&lt;4&gt; &gt; my_heap; return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7358 Trac 1.4.3 timblechmann Mon, 19 Nov 2012 12:16:35 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7358#comment:1 https://svn.boost.org/trac10/ticket/7358#comment:1 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/81421" title="heap: workaround for msvc lookup bug attempt to fix #7358">[81421]</a>) heap: workaround for msvc lookup bug </p> <p> attempt to fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7358" title="#7358: Bugs: typedef T in Comparison class clashes with template argument T in ... (closed: fixed)">#7358</a> </p> Ticket