Boost logo

Boost :

Subject: Re: [boost] [heap] typedef T gets prevalence over template parameter
From: Tim Blechmann (tim_at_[hidden])
Date: 2012-09-07 03:40:29


> 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.
>
> I.e. the following pattern occurs:
>
> template<class T, class Cmp> struct heap_base : Cmp
> {
> typedef T value_type; // value_type = Cmp::T
> }
>
> I don't know if this is a bug, a user issue, or a compiler issue. But it
> caused me a lot of headache when I was trying to apply Jeremiah's
> indirect_cmp with Boost.Heap.

hm ... this code works with gcc and with clang ... afaict, msvc does not
resolve T correctly.

not sure what is the best way to work around this, as every identifier
that we can use instead of T could also clash with a declaration in Cmp :/

tim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk