CVC3
|
00001 /*****************************************************************************/ 00002 /*! 00003 * \file expr_hash.h 00004 * \brief Definition of the API to expression package. See class Expr for details. 00005 * 00006 * Author: Clark Barrett 00007 * 00008 * Created: Tue Nov 26 00:27:40 2002 00009 * 00010 * <hr> 00011 * 00012 * License to use, copy, modify, sell and/or distribute this software 00013 * and its documentation for any purpose is hereby granted without 00014 * royalty, subject to the terms and conditions defined in the \ref 00015 * LICENSE file provided with this distribution. 00016 * 00017 * <hr> 00018 * 00019 * Define std::hash<Expr> and std::hash<std::string> for hash_map and 00020 * hash_set over Expr class. 00021 */ 00022 /*****************************************************************************/ 00023 00024 #ifndef _cvc3__expr_h_ 00025 #include "expr.h" 00026 #endif 00027 00028 #ifndef _cvc3__include__expr_hash_h_ 00029 #define _cvc3__include__expr_hash_h_ 00030 00031 #include "hash_fun.h" 00032 namespace Hash 00033 { 00034 00035 template<> struct hash<CVC3::Expr> 00036 { 00037 size_t operator()(const CVC3::Expr& e) const { return e.hash(); } 00038 }; 00039 00040 template<> class hash<std::string> { 00041 private: 00042 hash<const char*> h; 00043 public: 00044 size_t operator()(const std::string& s) const { 00045 return h(s.c_str()); 00046 } 00047 }; 00048 00049 } 00050 00051 #endif