2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FORMAT_FORMATTER_H
11 #define _LIBCPP___FORMAT_FORMATTER_H
13 #include <__availability>
15 #include <__format/format_fwd.h>
17 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18 # pragma GCC system_header
21 _LIBCPP_BEGIN_NAMESPACE_STD
23 #if _LIBCPP_STD_VER >= 20
25 /// The default formatter template.
27 /// [format.formatter.spec]/5
28 /// If F is a disabled specialization of formatter, these values are false:
29 /// - is_default_constructible_v<F>,
30 /// - is_copy_constructible_v<F>,
31 /// - is_move_constructible_v<F>,
32 /// - is_copy_assignable<F>, and
33 /// - is_move_assignable<F>.
34 template <class _Tp
, class _CharT
>
35 struct _LIBCPP_TEMPLATE_VIS formatter
{
37 formatter(const formatter
&) = delete;
38 formatter
& operator=(const formatter
&) = delete;
41 # if _LIBCPP_STD_VER >= 23
44 _LIBCPP_HIDE_FROM_ABI
constexpr void __set_debug_format(_Tp
& __formatter
) {
45 if constexpr (requires
{ __formatter
.set_debug_format(); })
46 __formatter
.set_debug_format();
49 # endif // _LIBCPP_STD_VER >= 23
50 #endif // _LIBCPP_STD_VER >= 20
52 _LIBCPP_END_NAMESPACE_STD
54 #endif // _LIBCPP___FORMAT_FORMATTER_H