Opened 10 years ago
Closed 10 years ago
#7358 closed Bugs (fixed)
typedef T in Comparison class clashes with template argument T in d_ary_heap
Reported by: | Owned by: | timblechmann | |
---|---|---|---|
Milestone: | To Be Determined | Component: | heap |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | indirect compare | Cc: |
Description
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
}
See below for a complete failing example.
This is a problem when Boost.Heap is used in combination with boost/pending/indirect_cmp.hpp.
#include <boost/heap/d_ary_heap.hpp>
struct less {
typedef int T; bool operator()(const int& a, const int& b) const {
return a < b;
}
};
int main() {
boost::heap::d_ary_heap<int, boost::heap::compare<less>, boost::heap::arity<4> > my_heap; return 0;
}
(In [81421]) heap: workaround for msvc lookup bug
attempt to fix #7358