mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:30:05 +00:00 
			
		
		
		
	Hash utility
This commit is contained in:
		
							parent
							
								
									8d2fcf3802
								
							
						
					
					
						commit
						32e8ca72a0
					
				
					 3 changed files with 43 additions and 0 deletions
				
			
		
							
								
								
									
										21
									
								
								wxdata/include/scwx/util/hash.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								wxdata/include/scwx/util/hash.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <string> | ||||
| #include <utility> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace util | ||||
| { | ||||
| 
 | ||||
| template<class Key> | ||||
| struct hash; | ||||
| 
 | ||||
| template<> | ||||
| struct hash<std::pair<std::string, std::string>> | ||||
| { | ||||
|    size_t operator()(const std::pair<std::string, std::string>& x) const; | ||||
| }; | ||||
| 
 | ||||
| } // namespace util
 | ||||
| } // namespace scwx
 | ||||
							
								
								
									
										20
									
								
								wxdata/source/scwx/util/hash.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								wxdata/source/scwx/util/hash.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| #include <scwx/util/hash.hpp> | ||||
| 
 | ||||
| #include <boost/container_hash/hash.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace util | ||||
| { | ||||
| 
 | ||||
| size_t hash<std::pair<std::string, std::string>>::operator()( | ||||
|    const std::pair<std::string, std::string>& x) const | ||||
| { | ||||
|    size_t seed = 0; | ||||
|    boost::hash_combine(seed, x.first); | ||||
|    boost::hash_combine(seed, x.second); | ||||
|    return seed; | ||||
| } | ||||
| 
 | ||||
| } // namespace util
 | ||||
| } // namespace scwx
 | ||||
|  | @ -46,6 +46,7 @@ set(SRC_PROVIDER source/scwx/provider/aws_level2_data_provider.cpp | |||
|                  source/scwx/provider/nexrad_data_provider_factory.cpp) | ||||
| set(HDR_UTIL include/scwx/util/environment.hpp | ||||
|              include/scwx/util/float.hpp | ||||
|              include/scwx/util/hash.hpp | ||||
|              include/scwx/util/iterator.hpp | ||||
|              include/scwx/util/logger.hpp | ||||
|              include/scwx/util/map.hpp | ||||
|  | @ -56,6 +57,7 @@ set(HDR_UTIL include/scwx/util/environment.hpp | |||
|              include/scwx/util/vectorbuf.hpp) | ||||
| set(SRC_UTIL source/scwx/util/environment.cpp | ||||
|              source/scwx/util/float.cpp | ||||
|              source/scwx/util/hash.cpp | ||||
|              source/scwx/util/logger.cpp | ||||
|              source/scwx/util/rangebuf.cpp | ||||
|              source/scwx/util/streams.cpp | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat