overload.h 711 B

1234567891011121314151617181920212223
  1. // Copyright (c) Meta Platforms, Inc. and affiliates.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include "rocksdb/rocksdb_namespace.h"
  7. namespace ROCKSDB_NAMESPACE {
  8. // A helper template that can combine multiple functors into a single one to be
  9. // used with std::visit for example. It also works with lambdas, since it
  10. // comes with an explicit deduction guide.
  11. template <typename... Ts>
  12. struct overload : Ts... {
  13. using Ts::operator()...;
  14. };
  15. template <typename... Ts>
  16. overload(Ts...) -> overload<Ts...>;
  17. } // namespace ROCKSDB_NAMESPACE