libzypp  15.28.6
Hash.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_BASE_HASH_H
13 #define ZYPP_BASE_HASH_H
14 
15 #include <iosfwd>
16 #include <unordered_set>
17 #include <unordered_map>
18 
26 #define ZYPP_DEFINE_ID_HASHABLE(C) \
27 namespace std { \
28  template<class Tp> struct hash; \
29  template<> struct hash<C> \
30  { \
31  size_t operator()( const C & __s ) const \
32  { return __s.id(); } \
33  }; \
34 }
35 
37 namespace std
38 {
40  template<class D>
41  inline unordered_set<D> * rwcowClone( const std::unordered_set<D> * rhs )
42  { return new std::unordered_set<D>( *rhs ); }
43 
45  template<class K, class V>
46  inline std::unordered_map<K,V> * rwcowClone( const std::unordered_map<K,V> * rhs )
47  { return new std::unordered_map<K,V>( *rhs ); }
48 } // namespace std
50 #endif // ZYPP_BASE_HASH_H
unordered_set< D > * rwcowClone(const std::unordered_set< D > *rhs)
clone function for RW_pointer
Definition: Hash.h:41