Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6791 closed Feature Requests (fixed)

Support boost::array

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: Marshall Clow
Milestone: To Be Determined Component: array
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

boost::hash_value appears to lack support for boost::array. Could you add it?

Isn't it possible to support all containers in a generic way?

Change History (3)

comment:1 by Daniel James, 11 years ago

Component: hasharray
Owner: changed from Daniel James to Marshall Clow

It isn't possible to do it generically, because equality isn't always defined the same for all containers.

Support needs to be added to array itself, which is pretty easy, it just needs to include <boost/functional/hash_fwd.hpp> and then add something like the following to the same namespace as array (so that it will be picked up by ADL):

template<....>
std::size_t hash_value(array<....> const& x) {
    return boost::hash_range(x.begin(), x.end());
}

comment:2 by Marshall Clow, 11 years ago

Resolution: fixed
Status: newclosed

(In [77976]) Added support for Boost.Hash to Boost.Array; fixes #6791

comment:3 by Olaf van der Spek <olafvdspek@…>, 11 years ago

It isn't possible to do it generically, because equality isn't always defined the same for all containers.

Does that matter? Can't you just do "return boost::hash_range(x.begin(), x.end());"?

Support needs to be added to array itself,

What about std::array?

Note: See TracTickets for help on using tickets.