declare_folded_class NO LONGER _in_file
[hiphop-php.git] / hphp / util / hash-set.h
blob08336940e74be5e40fc6a3823e10a226bce2d863
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #pragma once
18 #include "hphp/util/functional.h"
19 #include "folly/container/F14Set.h"
20 #include <functional>
21 #include <string>
23 namespace HPHP {
25 // Similar ref/iter stability as std::unordered_set, and allocates each
26 // instance of T separately, never moving.
27 template <class T, class V=std::hash<T>, class W=std::equal_to<T>>
28 using hphp_hash_set = folly::F14NodeSet<T,V,W>;
30 // Fast sets do not have ref/iter stability on rehash, but allocate space
31 // for values in bulk. Will use F14ValueSet or F14VectorSet depending on
32 // sizeof(T).
33 template <class T, class V=std::hash<T>, class W=std::equal_to<T>>
34 using hphp_fast_set = folly::F14FastSet<T,V,W>;
36 using hphp_fast_string_set = hphp_fast_set<std::string, string_hash>;
38 // std::string keyed tables, stable entries do not move on rehash.
39 using hphp_string_set = hphp_hash_set<std::string, string_hash>;
41 using hphp_string_iset =
42 hphp_hash_set<std::string, string_hashi, string_eqstri>;
44 using hphp_fast_string_iset =
45 hphp_hash_set<std::string, string_hashi, string_eqstri>;
47 // c_str-keyed tables, entries do not move on rehash.
48 using hphp_const_char_iset = hphp_hash_set<const char *, hashi, eqstri>;