better.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. namespace facebook {
  9. namespace better {
  10. /*
  11. * `Better` is a trivial collection of basic tools borrowed from other low-level
  12. * general purpose libraries (like Folly, Abseil or Boost). The main goals of
  13. * Better:
  14. * - Make the codebase more portable;
  15. * - Make the dependency list explicit (by decoupling it as a dependency list of
  16. * Better);
  17. * - Make relying on modern C++ patterns and tools in code simple and easy.
  18. * - Make executing experiments with different dependencies easier.
  19. *
  20. * What should be part of Better and what should not? Should I add some piece of
  21. * functionality in the Better? Here is a quick checklist.
  22. *
  23. * If one of the following is true, yes, go for it:
  24. * - If some feature is already in some future C++ standard (possibly in draft
  25. * stage) and it's already implemented in some 3rd party library.
  26. * - If some standardized feature of C++ is implemented in the standard not in
  27. * the most efficient way (because the standard enforces some tricky constraints
  28. * (like always-valid iterators) which nobody uses and should use), but you have
  29. * a library that does it right providing exact same interface.
  30. *
  31. * If one of the following is true, please do *NOT* do it (at least as part of
  32. * the library):
  33. * - You want to use some very fancy pattern that your favorite library (but
  34. * nothing else) provides, and You want to make this pattern very command in the
  35. * code base. Your hope is that this pattern will conquer the world and be
  36. * a part of the C++ standard eventually.
  37. * - You favorite library provides some general purpose container that 10x times
  38. * faster than the standard one, so You want to use that in the code base. That
  39. * container does not have compatible API though (because it's a clear trade-off
  40. * with efficiency, of course).
  41. */
  42. /*
  43. * Configuration
  44. */
  45. /*
  46. * Enables using Folly containers instead of standard ones (such as map, vector,
  47. * small_vector, optional and etc.)
  48. * Custom containers are only enabled in release mode. Using custom stuff
  49. * complicates debugging process because it breaks embedded into IDE
  50. * introspections mechanisms.
  51. */
  52. #ifndef DEBUG
  53. #define BETTER_USE_FOLLY_CONTAINERS
  54. #endif
  55. } // namespace better
  56. } // namespace facebook