2 +----------------------------------------------------------------------+
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 #ifndef incl_HPHP_HASH_SET_H_
17 #define incl_HPHP_HASH_SET_H_
19 #include "hphp/util/functional.h"
20 #include "folly/container/F14Set.h"
26 // Similar ref/iter stability as std::unordered_set, and allocates each
27 // instance of T separately, never moving.
28 template <class T
, class V
=std::hash
<T
>, class W
=std::equal_to
<T
>>
29 using hphp_hash_set
= folly::F14NodeSet
<T
,V
,W
>;
31 // Fast sets do not have ref/iter stability on rehash, but allocate space
32 // for values in bulk. Will use F14ValueSet or F14VectorSet depending on
34 template <class T
, class V
=std::hash
<T
>, class W
=std::equal_to
<T
>>
35 using hphp_fast_set
= folly::F14FastSet
<T
,V
,W
>;
37 using hphp_fast_string_set
= hphp_fast_set
<std::string
, string_hash
>;
39 // std::string keyed tables, stable entries do not move on rehash.
40 using hphp_string_set
= hphp_hash_set
<std::string
, string_hash
>;
42 using hphp_string_iset
=
43 hphp_hash_set
<std::string
, string_hashi
, string_eqstri
>;
45 using hphp_fast_string_iset
=
46 hphp_hash_set
<std::string
, string_hashi
, string_eqstri
>;
48 // c_str-keyed tables, entries do not move on rehash.
49 using hphp_const_char_iset
= hphp_hash_set
<const char *, hashi
, eqstri
>;