Subject: [Boost-bugs] [Boost C++ Libraries] #7358: typedef T in Comparison class clashes with template argument T in d_ary_heap
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-10 14:54:56
#7358: typedef T in Comparison class clashes with template argument T in
d_ary_heap
-------------------------------------------------+--------------------------
Reporter: Alex Hagen-Zanker <ahh34@â¦> | Owner: timblechmann
Type: Bugs | Status: new
Milestone: To Be Determined | Component: heap
Version: Boost 1.52.0 | Severity: Problem
Keywords: indirect compare |
-------------------------------------------------+--------------------------
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;
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7358> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC