xref: /freebsd/contrib/llvm-project/libcxx/include/__format/formatter.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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 
10 #ifndef _LIBCPP___FORMAT_FORMATTER_H
11 #define _LIBCPP___FORMAT_FORMATTER_H
12 
13 #include <__config>
14 #include <__fwd/format.h>
15 
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 #  pragma GCC system_header
18 #endif
19 
20 _LIBCPP_BEGIN_NAMESPACE_STD
21 
22 #if _LIBCPP_STD_VER >= 20
23 
24 /// The default formatter template.
25 ///
26 /// [format.formatter.spec]/5
27 /// If F is a disabled specialization of formatter, these values are false:
28 /// - is_default_constructible_v<F>,
29 /// - is_copy_constructible_v<F>,
30 /// - is_move_constructible_v<F>,
31 /// - is_copy_assignable<F>, and
32 /// - is_move_assignable<F>.
33 template <class _Tp, class _CharT>
34 struct _LIBCPP_TEMPLATE_VIS formatter {
35   formatter()                            = delete;
36   formatter(const formatter&)            = delete;
37   formatter& operator=(const formatter&) = delete;
38 };
39 
40 #  if _LIBCPP_STD_VER >= 23
41 
42 template <class _Tp>
__set_debug_format(_Tp & __formatter)43 _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {
44   if constexpr (requires { __formatter.set_debug_format(); })
45     __formatter.set_debug_format();
46 }
47 
48 #  endif // _LIBCPP_STD_VER >= 23
49 #endif   // _LIBCPP_STD_VER >= 20
50 
51 _LIBCPP_END_NAMESPACE_STD
52 
53 #endif // _LIBCPP___FORMAT_FORMATTER_H
54