Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/ext/__hash is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_EXT_HASH
0011 #define _LIBCPP_EXT_HASH
0012 
0013 #pragma GCC system_header
0014 
0015 #include <__config>
0016 #include <cstring>
0017 #include <stddef.h>
0018 #include <string>
0019 
0020 namespace __gnu_cxx {
0021 
0022 template <typename _Tp>
0023 struct _LIBCPP_TEMPLATE_VIS hash {};
0024 
0025 template <>
0026 struct _LIBCPP_TEMPLATE_VIS hash<const char*> : public std::__unary_function<const char*, size_t> {
0027   _LIBCPP_HIDE_FROM_ABI size_t operator()(const char* __c) const _NOEXCEPT {
0028     return std::__do_string_hash(__c, __c + strlen(__c));
0029   }
0030 };
0031 
0032 template <>
0033 struct _LIBCPP_TEMPLATE_VIS hash<char*> : public std::__unary_function<char*, size_t> {
0034   _LIBCPP_HIDE_FROM_ABI size_t operator()(char* __c) const _NOEXCEPT {
0035     return std::__do_string_hash<const char*>(__c, __c + strlen(__c));
0036   }
0037 };
0038 
0039 template <>
0040 struct _LIBCPP_TEMPLATE_VIS hash<char> : public std::__unary_function<char, size_t> {
0041   _LIBCPP_HIDE_FROM_ABI size_t operator()(char __c) const _NOEXCEPT { return __c; }
0042 };
0043 
0044 template <>
0045 struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public std::__unary_function<signed char, size_t> {
0046   _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __c) const _NOEXCEPT { return __c; }
0047 };
0048 
0049 template <>
0050 struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public std::__unary_function<unsigned char, size_t> {
0051   _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __c) const _NOEXCEPT { return __c; }
0052 };
0053 
0054 template <>
0055 struct _LIBCPP_TEMPLATE_VIS hash<short> : public std::__unary_function<short, size_t> {
0056   _LIBCPP_HIDE_FROM_ABI size_t operator()(short __c) const _NOEXCEPT { return __c; }
0057 };
0058 
0059 template <>
0060 struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public std::__unary_function<unsigned short, size_t> {
0061   _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __c) const _NOEXCEPT { return __c; }
0062 };
0063 
0064 template <>
0065 struct _LIBCPP_TEMPLATE_VIS hash<int> : public std::__unary_function<int, size_t> {
0066   _LIBCPP_HIDE_FROM_ABI size_t operator()(int __c) const _NOEXCEPT { return __c; }
0067 };
0068 
0069 template <>
0070 struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public std::__unary_function<unsigned int, size_t> {
0071   _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __c) const _NOEXCEPT { return __c; }
0072 };
0073 
0074 template <>
0075 struct _LIBCPP_TEMPLATE_VIS hash<long> : public std::__unary_function<long, size_t> {
0076   _LIBCPP_HIDE_FROM_ABI size_t operator()(long __c) const _NOEXCEPT { return __c; }
0077 };
0078 
0079 template <>
0080 struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public std::__unary_function<unsigned long, size_t> {
0081   _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __c) const _NOEXCEPT { return __c; }
0082 };
0083 } // namespace __gnu_cxx
0084 
0085 #endif // _LIBCPP_EXT_HASH