| //===----------------------------------------------------------------------===// |
| // The LLVM Compiler Infrastructure |
| // This file is dual licensed under the MIT and the University of Illinois Open |
| // Source Licenses. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // : public unary_function<T, size_t> |
| // size_t operator()(T val) const; |
| static_assert((std::is_same<typename H::argument_type, SV>::value), "" ); |
| static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" ); |
| typedef typename SV::value_type char_type; |
| typedef std::basic_string<char_type> String; |
| typedef std::hash<String> SH; |
| for ( int i = 0; i < 10; ++i ) |
| g1[i] = g2[9-i] = static_cast<char_type>('0' + i); |
| assert(sh(ss1) == h(s1)); |
| assert(sh(ss2) == h(s2)); |
| test<std::string_view>(); |
| #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS |
| test<std::u16string_view>(); |
| test<std::u32string_view>(); |
| #endif // _LIBCPP_HAS_NO_UNICODE_CHARS |
| test<std::wstring_view>(); |