Opened 8 years ago

Closed 7 years ago

#10672 closed Bugs (fixed)

std::iterator_traits<boost::unordered_map<K,M>::iterator>::pointer should be value_type*, not detail::ptr_node<...>

Reported by: anonymous Owned by: Daniel James
Milestone: To Be Determined Component: unordered
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description (last modified by Daniel James)

The iterator type looks like:

template <typename NodePointer, typename Value>
struct iterator
    : public boost::iterator<
        std::forward_iterator_tag, Value, std::ptrdiff_t,
        NodePointer, Value&>

The NodePointer argument here (which is boost::unordered::detail::ptr_node<...>) becomes the iterator_traits<>::pointer type.

But iterator's operator->() returns Value *:

Value* operator->() const {
    return &node_->value();
}

Seems like this should be changed.

Change History (4)

comment:1 by Daniel James, 8 years ago

Description: modified (diff)
Status: newassigned

comment:2 by Daniel James, 8 years ago

Fix in develop: https://github.com/boostorg/unordered/commit/99985bb1b26ea13e9a85f723cfa9369a4c9ee257

Will hopefully be included in the next release.

comment:3 by anonymous, 8 years ago

Awesome! Thank you!

comment:4 by Daniel James, 7 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.