Home | History | Annotate | Download | only in ext
      1 // -*- C++ -*-
      2 //===------------------------- hash_set ------------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 
     11 #ifndef _LIBCPP_EXT_HASH
     12 #define _LIBCPP_EXT_HASH
     13 
     14 #pragma GCC system_header
     15 
     16 #include <string>
     17 #include <cstring>
     18 
     19 namespace __gnu_cxx {
     20 using namespace std;
     21 
     22 template <typename T> struct _LIBCPP_TYPE_VIS hash : public std::hash<T>
     23     { };
     24 
     25 template <> struct _LIBCPP_TYPE_VIS hash<const char*>
     26     : public unary_function<const char*, size_t>
     27 {
     28     _LIBCPP_INLINE_VISIBILITY
     29     size_t operator()(const char *__c) const _NOEXCEPT
     30     {
     31         return __do_string_hash(__c, __c + strlen(__c));
     32     }
     33 };
     34 
     35 template <> struct _LIBCPP_TYPE_VIS hash<char *>
     36     : public unary_function<char*, size_t>
     37 {
     38     _LIBCPP_INLINE_VISIBILITY
     39     size_t operator()(char *__c) const _NOEXCEPT
     40     {
     41         return __do_string_hash<const char *>(__c, __c + strlen(__c));
     42     }
     43 };
     44 }
     45 
     46 #endif  // _LIBCPP_EXT_HASH
     47