File: phmap_fwd_decl.h

package info (click to toggle)
parallel-hashmap 1.4.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,872 kB
  • sloc: cpp: 20,492; ansic: 1,114; python: 492; makefile: 85; haskell: 56; perl: 43; sh: 23
file content (186 lines) | stat: -rw-r--r-- 7,905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#if !defined(phmap_fwd_decl_h_guard_)
#define phmap_fwd_decl_h_guard_

// ---------------------------------------------------------------------------
// Copyright (c) 2019, Gregory Popovitch - greg7mdp@gmail.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
// ---------------------------------------------------------------------------

#ifdef _MSC_VER
    #pragma warning(push)  
    #pragma warning(disable : 4514) // unreferenced inline function has been removed
    #pragma warning(disable : 4710) // function not inlined
    #pragma warning(disable : 4711) // selected for automatic inline expansion
#endif

#include <memory>
#include <utility>
#include <mutex>

#if defined(PHMAP_USE_ABSL_HASH) && !defined(ABSL_HASH_HASH_H_)
    namespace absl { template <class T> struct Hash; };
#endif

namespace phmap {

#if defined(PHMAP_USE_ABSL_HASH)
    template <class T> using Hash = ::absl::Hash<T>;
#else
    template <class T> struct Hash;
#endif

    template <class T> struct EqualTo;
    template <class T> struct Less;
    template <class T> using Allocator      = typename std::allocator<T>;
    template<class T1, class T2> using Pair = typename std::pair<T1, T2>;

    class NullMutex;

    namespace priv {

        // The hash of an object of type T is computed by using phmap::Hash.
        template <class T, class E = void>
        struct HashEq 
        {
            using Hash = phmap::Hash<T>;
            using Eq   = phmap::EqualTo<T>;
        };

        template <class T>
        using hash_default_hash = typename priv::HashEq<T>::Hash;

        template <class T>
        using hash_default_eq = typename priv::HashEq<T>::Eq;

        // type alias for std::allocator so we can forward declare without including other headers
        template <class T>  
        using Allocator = typename phmap::Allocator<T>;

        // type alias for std::pair so we can forward declare without including other headers
        template<class T1, class T2> 
        using Pair = typename phmap::Pair<T1, T2>;

    }  // namespace priv

    // ------------- forward declarations for hash containers ----------------------------------
    template <class T, 
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>>  // alias for std::allocator
        class flat_hash_set;

    template <class K, class V,
              class Hash  = phmap::priv::hash_default_hash<K>,
              class Eq    = phmap::priv::hash_default_eq<K>,
              class Alloc = phmap::priv::Allocator<
                            phmap::priv::Pair<const K, V>>> // alias for std::allocator
        class flat_hash_map;
    
    template <class T, 
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>> // alias for std::allocator
        class node_hash_set;

    template <class Key, class Value,
              class Hash  = phmap::priv::hash_default_hash<Key>,
              class Eq    = phmap::priv::hash_default_eq<Key>,
              class Alloc = phmap::priv::Allocator<
                            phmap::priv::Pair<const Key, Value>>> // alias for std::allocator
        class node_hash_map;

    template <class T,
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>, // alias for std::allocator
              size_t N    = 4,                  // 2**N submaps
              class Mutex = phmap::NullMutex>   // use std::mutex to enable internal locks
        class parallel_flat_hash_set;

    template <class K, class V,
              class Hash  = phmap::priv::hash_default_hash<K>,
              class Eq    = phmap::priv::hash_default_eq<K>,
              class Alloc = phmap::priv::Allocator<
                            phmap::priv::Pair<const K, V>>, // alias for std::allocator
              size_t N    = 4,                  // 2**N submaps
              class Mutex = phmap::NullMutex>   // use std::mutex to enable internal locks
        class parallel_flat_hash_map;

    template <class T, 
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>, // alias for std::allocator
              size_t N    = 4,                  // 2**N submaps
              class Mutex = phmap::NullMutex>   // use std::mutex to enable internal locks
        class parallel_node_hash_set;

    template <class Key, class Value,
              class Hash  = phmap::priv::hash_default_hash<Key>,
              class Eq    = phmap::priv::hash_default_eq<Key>,
              class Alloc = phmap::priv::Allocator<
                            phmap::priv::Pair<const Key, Value>>, // alias for std::allocator
              size_t N    = 4,                  // 2**N submaps
              class Mutex = phmap::NullMutex>   // use std::mutex to enable internal locks
        class parallel_node_hash_map;

    // -----------------------------------------------------------------------------
    // phmap::parallel_*_hash_* using std::mutex by default
    // -----------------------------------------------------------------------------
    template <class T,
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>,
              size_t N    = 4>
    using parallel_flat_hash_set_m = parallel_flat_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;

    template <class K, class V,
              class Hash  = phmap::priv::hash_default_hash<K>,
              class Eq    = phmap::priv::hash_default_eq<K>,
              class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
              size_t N    = 4>
    using parallel_flat_hash_map_m = parallel_flat_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;

    template <class T,
              class Hash  = phmap::priv::hash_default_hash<T>,
              class Eq    = phmap::priv::hash_default_eq<T>,
              class Alloc = phmap::priv::Allocator<T>,
              size_t N    = 4>
    using parallel_node_hash_set_m = parallel_node_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;

    template <class K, class V,
              class Hash  = phmap::priv::hash_default_hash<K>,
              class Eq    = phmap::priv::hash_default_eq<K>,
              class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
              size_t N     = 4>
    using parallel_node_hash_map_m = parallel_node_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;

    // ------------- forward declarations for btree containers ----------------------------------
    template <typename Key, typename Compare = phmap::Less<Key>,
              typename Alloc = phmap::Allocator<Key>>
        class btree_set;

    template <typename Key, typename Compare = phmap::Less<Key>,
              typename Alloc = phmap::Allocator<Key>>
        class btree_multiset;

    template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
              typename Alloc = phmap::Allocator<phmap::priv::Pair<const Key, Value>>>
        class btree_map;
    
    template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
              typename Alloc = phmap::Allocator<phmap::priv::Pair<const Key, Value>>>
        class btree_multimap;

}  // namespace phmap


#ifdef _MSC_VER
     #pragma warning(pop)  
#endif

#endif // phmap_fwd_decl_h_guard_