|
Boost Users : |
Subject: [Boost-users] [heap] Singular handle issue with MSVC iterator debug facilities
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2017-08-09 16:16:35
Hi,
Using VS2017 and Boost 1.64, I'm compiling a program which uses
boost::heap::d_ary_heap.
In debug configuration (with default _ITERATOR_DEBUG_LEVEL),
I'm observing issues at run-time when a handle of item on the heap is
compared against default-constructed instance of handle_type.
BTW, the handle_type compiled in is based on std::list::iterator
as defined in boost::heap::detail::priority_queue_mutable_wrapper.
The issue is that MSVC iterator debug facilities break execution with
File: c:\program files (x86)\microsoft visual
studio\2017\professional\vc\tools\msvc\14.10.25017\include\list
Line: 290
Expression: list iterators incompatible
AFAIU, handle_type{}; seems to yield handle h object wrapping singular iterator.
Below, minimal example to reproduces the problem is included.
While debugging the sample, Visual C++ debugger does not show the iterator
wrapped by the handle as default-constructed with null node pointer.
Instead, it displays garbage: ((???, ???), ???)
// ------------------------------------------------------------------
#include <cstdint>
#include <functional>
#include <boost/heap/d_ary_heap.hpp>
using NodeID = std::uint32_t;
using EdgeWeight = std::int32_t;
using HeapData = std::pair<EdgeWeight, NodeID>;
using HeapContainer = boost::heap::d_ary_heap<
HeapData,
boost::heap::arity<4>,
boost::heap::mutable_<true>,
boost::heap::compare<std::greater<HeapData>>>;
using HandleType = HeapContainer::handle_type;
int main()
{
HeapContainer heap;
auto const handle = heap.push(std::make_pair(100, 1));
handle == HandleType{}; // _DEBUG_ERROR("list iterators incompatible");
return 0;
}
// ------------------------------------------------------------------
Is this a known MSVC drawback while working with boost::heap::d_ary_heap
or above the handle_type is actually misused?
Best regards,
-- Mateusz Loskot, http://mateusz.loskot.net
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net