File indexing completed on 2026-05-03 08:13:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___CXX03___FORMAT_CONCEPTS_H
0011 #define _LIBCPP___CXX03___FORMAT_CONCEPTS_H
0012
0013 #include <__cxx03/__concepts/same_as.h>
0014 #include <__cxx03/__concepts/semiregular.h>
0015 #include <__cxx03/__config>
0016 #include <__cxx03/__format/format_parse_context.h>
0017 #include <__cxx03/__fwd/format.h>
0018 #include <__cxx03/__fwd/tuple.h>
0019 #include <__cxx03/__tuple/tuple_size.h>
0020 #include <__cxx03/__type_traits/is_specialization.h>
0021 #include <__cxx03/__type_traits/remove_const.h>
0022 #include <__cxx03/__type_traits/remove_reference.h>
0023 #include <__cxx03/__utility/pair.h>
0024
0025 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0026 # pragma GCC system_header
0027 #endif
0028
0029 _LIBCPP_BEGIN_NAMESPACE_STD
0030
0031 #if _LIBCPP_STD_VER >= 20
0032
0033
0034 template <class _CharT>
0035 concept __fmt_char_type =
0036 same_as<_CharT, char>
0037 # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
0038 || same_as<_CharT, wchar_t>
0039 # endif
0040 ;
0041
0042
0043
0044
0045
0046 template <class _CharT>
0047 using __fmt_iter_for = _CharT*;
0048
0049 template <class _Tp, class _Context, class _Formatter = typename _Context::template formatter_type<remove_const_t<_Tp>>>
0050 concept __formattable_with =
0051 semiregular<_Formatter> &&
0052 requires(_Formatter& __f,
0053 const _Formatter& __cf,
0054 _Tp&& __t,
0055 _Context __fc,
0056 basic_format_parse_context<typename _Context::char_type> __pc) {
0057 { __f.parse(__pc) } -> same_as<typename decltype(__pc)::iterator>;
0058 { __cf.format(__t, __fc) } -> same_as<typename _Context::iterator>;
0059 };
0060
0061 template <class _Tp, class _CharT>
0062 concept __formattable =
0063 __formattable_with<remove_reference_t<_Tp>, basic_format_context<__fmt_iter_for<_CharT>, _CharT>>;
0064
0065 # if _LIBCPP_STD_VER >= 23
0066 template <class _Tp, class _CharT>
0067 concept formattable = __formattable<_Tp, _CharT>;
0068
0069
0070
0071
0072
0073
0074 template <class _Tp>
0075 concept __fmt_pair_like =
0076 __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
0077
0078 # endif
0079 #endif
0080
0081 _LIBCPP_END_NAMESPACE_STD
0082
0083 #endif