Opened 11 years ago

Closed 9 years ago

#6792 closed Feature Requests (fixed)

hash_value() for iterator_range

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: Neil Groves
Milestone: Boost 1.56.0 Component: range
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

"hash_value(boost::iterator_range<const char*>());" uses "operator unspecified_bool_type() const" which is not right.

Could you support hash_value() properly? Could you remove operator bool()?

Change History (5)

comment:1 by Daniel James, 11 years ago

Component: Nonerange
Owner: set to Neil Groves

hash_value would be nice for iterator range. See [77976] for how an example of how to support it, hash_value is picked up by ADL.

The problem with operator bool is really a design flaw in Boost.Hash. It should be possible to turn it into an error by defining the macro BOOST_HASH_NO_IMPLICIT_CASTS, although that isn't defined by default because it might break valid code.

comment:2 by Neil Groves, 11 years ago

Milestone: To Be DeterminedBoost 1.50.0
Status: newassigned
Type: BugsFeature Requests

I'll attempt to implement the additional hash_value support by release 1.50. It looks simple enough. I will not remove the conversion to bool since this is a documented part of the public interface, and is not in error.

comment:3 by Neil Groves, 9 years ago

Milestone: Boost 1.50.0Boost 1.56.0

comment:4 by Neil Groves, 9 years ago

Implemented and committed on the develop branch.

comment:5 by Neil Groves, 9 years ago

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