नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
A template specialization that produces a hash value given a string_view.
template <class CharType, class Traits>
struct hash<basic_string_view<CharType, Traits>>
{
typedef basic_string_view<CharType, Traits> argument_type;
typedef size_t result_type;
size_t operator()(const basic_string_view<CharType, Traits>) const
noexcept;
};
Remarks
The hash of a string_view equals the hash of the underlying string object.
Example
//compile with: /std:c++17
#include <string>
#include <string_view>
#include <iostream>
using namespace std;
int main()
{
string_view sv{ "Hello world" };
string s{ "Hello world" };
cout << boolalpha << (hash<string_view>{}(sv)
== hash<string>{}(s)); // true
}