libzypp 17.38.15

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
38#if defined(__cpp_modules) || defined(__clang__)
39#define ZYPP_DEFINE_ID_HASHABLE(C) \
40 namespace std { \
41 template<> struct hash<C> \
42 { \
43 size_t operator()( const C & __s ) const \
44 { return __s.id(); } \
45 }; \
46}
47#else
48#define ZYPP_DEFINE_ID_HASHABLE(C) \
49 namespace std { \
50 template<class Tp> struct hash; \
51 template<> struct hash<C> \
52 { \
53 size_t operator()( const C & __s ) const \
54 { return __s.id(); } \
55 }; \
56}
57#endif
58
60 namespace std
61{
63 template<class D>
64 inline unordered_set<D> * rwcowClone( const std::unordered_set<D> * rhs )
65 { return new std::unordered_set<D>( *rhs ); }
66
68 template<class K, class V>
69 inline std::unordered_map<K,V> * rwcowClone( const std::unordered_map<K,V> * rhs )
70 { return new std::unordered_map<K,V>( *rhs ); }
71} // namespace std
73#endif // ZYPP_BASE_HASH_H
std
Definition ansi.h:855
std::rwcowClone
unordered_set< D > * rwcowClone(const std::unordered_set< D > *rhs)
clone function for RW_pointer
Definition Hash.h:64