mirror of
https://github.com/twitter/the-algorithm.git
synced 2025-01-09 18:59:25 +01:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#ifndef TWML_LIBTWML_INCLUDE_TWML_COMMON_H_
|
|
#define TWML_LIBTWML_INCLUDE_TWML_COMMON_H_
|
|
|
|
#define USE_ABSEIL_HASH 1
|
|
|
|
#if defined(USE_ABSEIL_HASH)
|
|
#include "absl/container/flat_hash_map.h"
|
|
#include "absl/container/flat_hash_set.h"
|
|
#elif defined(USE_DENSE_HASH)
|
|
#include <sparsehash/dense_hash_map>
|
|
#include <sparsehash/dense_hash_set>
|
|
#else
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#endif // USE_ABSEIL_HASH
|
|
|
|
|
|
namespace twml {
|
|
#if defined(USE_ABSEIL_HASH)
|
|
template<typename KeyType, typename ValueType>
|
|
using Map = absl::flat_hash_map<KeyType, ValueType>;
|
|
|
|
template<typename KeyType>
|
|
using Set = absl::flat_hash_set<KeyType>;
|
|
#elif defined(USE_DENSE_HASH)
|
|
// Do not use this unless an proper empty key can be found.
|
|
template<typename KeyType, typename ValueType>
|
|
using Map = google::dense_hash_map<KeyType, ValueType>;
|
|
|
|
template<typename KeyType>
|
|
using Set = google::dense_hash_set<KeyType>;
|
|
#else
|
|
template<typename KeyType, typename ValueType>
|
|
using Map = std::unordered_map<KeyType, ValueType>;
|
|
|
|
template<typename KeyType>
|
|
using Set = std::unordered_set<KeyType>;
|
|
#endif // USE_DENSE_HASH
|
|
|
|
} // namespace twml
|
|
|
|
#endif // TWML_LIBTWML_INCLUDE_TWML_COMMON_H_
|