Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6791 closed Feature Requests (fixed)

Support boost::array

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: marshall
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?

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by danieljames

  • Component changed from hash to array
  • Owner changed from danieljames to marshall

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 Changed 5 years ago by marshall

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 5 years ago by Olaf van der Spek <olafvdspek@…>

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?

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain marshall.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.