FbcodeMaps.h 728 B

1234567891011121314151617181920212223242526272829
  1. #ifndef C10_UTIL_FBCODEMAPS_H_
  2. #define C10_UTIL_FBCODEMAPS_H_
  3. // Map typedefs so that we can use folly's F14 maps in fbcode without
  4. // taking a folly dependency.
  5. #ifdef FBCODE_CAFFE2
  6. #include <folly/container/F14Map.h>
  7. #include <folly/container/F14Set.h>
  8. #else
  9. #include <unordered_map>
  10. #include <unordered_set>
  11. #endif
  12. namespace c10 {
  13. #ifdef FBCODE_CAFFE2
  14. template <typename Key, typename Value>
  15. using FastMap = folly::F14FastMap<Key, Value>;
  16. template <typename Key>
  17. using FastSet = folly::F14FastSet<Key>;
  18. #else
  19. template <typename Key, typename Value>
  20. using FastMap = std::unordered_map<Key, Value>;
  21. template <typename Key>
  22. using FastSet = std::unordered_set<Key>;
  23. #endif
  24. } // namespace c10
  25. #endif // C10_UTIL_FBCODEMAPS_H_