Opened 11 years ago

Closed 8 years ago

#5650 closed Feature Requests (fixed)

Adding hash_value for filesystem::path

Reported by: anonymous Owned by: Beman Dawes
Milestone: Boost 1.48.0 Component: filesystem
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

Will allow to set filesystem::path to the flyweight and unordered_* by this.

//in namespace boost::filesystem
size_t hash_value(const path& data)
{
    return boost::hash_value(data.native());
}

Attachments (1)

filesystem.patch (2.8 KB ) - added by Daniel James 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Daniel James, 11 years ago

Owner: changed from Beman Dawes to Daniel James
Status: newassigned

That won't work because path's operator== is not the same as the string's operator==, so paths that are equal will hash to different values. I'll write a patch when I get the chance. You also shouldn't call hash_value directly - if at a later date filesystem uses a custom string type, then that won't pick up its hash_value by ADL.

comment:2 by Beman Dawes, 11 years ago

Milestone: To Be DeterminedBoost 1.48.0
Owner: changed from Daniel James to Beman Dawes
Status: assignednew

comment:3 by Beman Dawes, 11 years ago

Owner: changed from Beman Dawes to Daniel James

by Daniel James, 11 years ago

Attachment: filesystem.patch added

comment:4 by Daniel James, 11 years ago

Owner: changed from Daniel James to Beman Dawes

Patch attached.

comment:5 by Beman Dawes, 8 years ago

Resolution: fixed
Status: newclosed

The patch was applied years ago, but the ticket was not closed at that time.

Note: See TracTickets for help on using tickets.