-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
std::hash<std::string_view> on cppreference
Section 24.4.5 in C++ 17 working draft N4659: Hash support:
Note: The hash value of a string view object is equal to the hash value of the corresponding string object.
Currently the following tests fail and although it's not std::string_view, you might consider this for core::string_view.
SECTION("hash-std::string") {
CHECK( std::hash<core::string_view>()("hello") == std::hash<std::string>()("hello") );
CHECK( std::hash<core::string_view>()("world") == std::hash<std::string>()("world") );
}
prompt> test-string-view.exe --reporter compact
string-view.cpp:383: failed: std::hash<core::string_view>()("hello") == std::hash<std::string>()("hello") for: 2191231550387646743 == 2762169579135187400
string-view.cpp:384: failed: std::hash<core::string_view>()("world") == std::hash<std::string>()("world") for: 5568329560871645431 == 8751027807033337960
Failed 1 test case, failed 2 assertions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels