Modify

Ticket #6791 (closed Feature Requests: fixed)

Opened 2 years ago

Last modified 2 years ago

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

Change History

comment:1 Changed 2 years ago by danieljames

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

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

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

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

comment:3 Changed 2 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?

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
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.