Opened 12 years ago

Closed 12 years ago

#4756 closed Feature Requests (fixed)

Support for C++0x type_index in hash

Reported by: ru.elric@… Owned by: Daniel James
Milestone: Boost 1.46.0 Component: hash
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

Boost hash currently does not support C++0x std::type_index.

Boost has a #define for availability of <typeindex> header - BOOST_NO_0X_HDR_TYPEINDEX. Therefore, adding support for std::type_index should be pretty straightforward.

Something along the lines could do:

#ifndef BOOST_NO_0X_HDR_TYPEINDEX
#include <typeindex>

namespace boost {
  std::size_t hash_value(const std::type_index &v) {
    return v.hash_code();
  }
}
#endif

Attachments (1)

hash.diff (1.3 KB ) - added by ru.elric@… 12 years ago.
Patch that resolves the issue.

Download all attachments as: .zip

Change History (6)

comment:1 by Daniel James, 12 years ago

Milestone: To Be DeterminedBoost-1.46.0
Status: newassigned

by ru.elric@…, 12 years ago

Attachment: hash.diff added

Patch that resolves the issue.

comment:2 by Daniel James, 12 years ago

(In [68145]) Support typeindex in hash. Refs #4756.

comment:3 by anonymous, 12 years ago

I believe there is a problem with the patch.

The following forward declaration must not be a template:

template <class Ch, class A>
std::size_t hash_value(std::type_index);

comment:4 by Daniel James, 12 years ago

(In [68182]) Fix copy and paste typo. Refs #4756.

comment:5 by Daniel James, 12 years ago

Resolution: fixed
Status: assignedclosed

(In [68199]) Merge typeindex support for hash. Fixes #4756.

Note: See TracTickets for help on using tickets.