Opened 10 years ago

Closed 9 years ago

#7294 closed Feature Requests (fixed)

boost::hash does not compile with ranges

Reported by: Gennady Proskurin <gpr@…> Owned by: Neil Groves
Milestone: Boost 1.56.0 Component: range
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc: dnljms@…

Description

boost::hash from boost 1.51 does not compile with iterator_range<const char*>. With boost 1.50 all compiles and works fine. Test program attached. gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

hash_range.cc:15:50:   instantiated from here
/opt/boost_1_51_0/include/boost/functional/hash/extensions.hpp:257:34: error: no matching function for call to ‘hash_value(const boost::iterator_range<const char*>&)’

Attachments (1)

hash_range.cc (370 bytes ) - added by Gennady Proskurin <gpr@…> 10 years ago.

Download all attachments as: .zip

Change History (7)

by Gennady Proskurin <gpr@…>, 10 years ago

Attachment: hash_range.cc added

comment:1 by Gennady Proskurin <gpr@…>, 10 years ago

c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

comment:2 by Gennady Proskurin <gpr@…>, 10 years ago

Summary: boost::hash does not compiles with rangesboost::hash does not compile with ranges

comment:3 by Daniel James, 10 years ago

Component: hashrange
Owner: changed from Daniel James to Neil Groves
Type: BugsFeature Requests

That's a bug fix, iterator_range has an implicit conversion to bool, which is why is was hashing - you really don't want that because it will only hash to 0 or 1. So it might have worked, but you get terrible performance for more than a few items.

If you want hashing support for iterator_range it will need to be added to that library. For an example of how to do that, open boost/array.hpp and search for 'hash'. It shouldn't be too hard to implement.

comment:4 by Daniel James, 10 years ago

Cc: dnljms@… added

comment:5 by Neil Groves, 9 years ago

Milestone: To Be DeterminedBoost 1.56.0
Status: newassigned

Implemented and committed to the develop branch.

comment:6 by Neil Groves, 9 years ago

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