formatter.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP___FORMAT_FORMATTER_H
  10. #define _LIBCPP___FORMAT_FORMATTER_H
  11. #include <__config>
  12. #include <__fwd/format.h>
  13. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # pragma GCC system_header
  15. #endif
  16. _LIBCPP_BEGIN_NAMESPACE_STD
  17. #if _LIBCPP_STD_VER >= 20
  18. /// The default formatter template.
  19. ///
  20. /// [format.formatter.spec]/5
  21. /// If F is a disabled specialization of formatter, these values are false:
  22. /// - is_default_constructible_v<F>,
  23. /// - is_copy_constructible_v<F>,
  24. /// - is_move_constructible_v<F>,
  25. /// - is_copy_assignable<F>, and
  26. /// - is_move_assignable<F>.
  27. template <class _Tp, class _CharT>
  28. struct _LIBCPP_TEMPLATE_VIS formatter {
  29. formatter() = delete;
  30. formatter(const formatter&) = delete;
  31. formatter& operator=(const formatter&) = delete;
  32. };
  33. # if _LIBCPP_STD_VER >= 23
  34. template <class _Tp>
  35. _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {
  36. if constexpr (requires { __formatter.set_debug_format(); })
  37. __formatter.set_debug_format();
  38. }
  39. # endif // _LIBCPP_STD_VER >= 23
  40. #endif // _LIBCPP_STD_VER >= 20
  41. _LIBCPP_END_NAMESPACE_STD
  42. #endif // _LIBCPP___FORMAT_FORMATTER_H