variant_size.h 695 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include <type_traits>
  5. #include "opentelemetry/nostd/detail/variant_fwd.h"
  6. #include "opentelemetry/version.h"
  7. OPENTELEMETRY_BEGIN_NAMESPACE
  8. namespace nostd
  9. {
  10. template <typename T>
  11. struct variant_size;
  12. template <typename T>
  13. struct variant_size<const T> : variant_size<T>
  14. {};
  15. template <typename T>
  16. struct variant_size<volatile T> : variant_size<T>
  17. {};
  18. template <typename T>
  19. struct variant_size<const volatile T> : variant_size<T>
  20. {};
  21. template <typename... Ts>
  22. struct variant_size<variant<Ts...>> : std::integral_constant<size_t, sizeof...(Ts)>
  23. {};
  24. } // namespace nostd
  25. OPENTELEMETRY_END_NAMESPACE