59 lines · c
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___FORMAT_FORMATTER_H11#define _LIBCPP___FORMAT_FORMATTER_H12 13#include <__config>14#include <__fwd/format.h>15 16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17# pragma GCC system_header18#endif19 20_LIBCPP_BEGIN_NAMESPACE_STD21 22#if _LIBCPP_STD_VER >= 2023 24struct __disabled_formatter {25 __disabled_formatter() = delete;26 __disabled_formatter(const __disabled_formatter&) = delete;27 __disabled_formatter& operator=(const __disabled_formatter&) = delete;28};29 30/// The default formatter template.31///32/// [format.formatter.spec]/533/// If F is a disabled specialization of formatter, these values are false:34/// - is_default_constructible_v<F>,35/// - is_copy_constructible_v<F>,36/// - is_move_constructible_v<F>,37/// - is_copy_assignable_v<F>, and38/// - is_move_assignable_v<F>.39template <class _Tp, class _CharT>40struct formatter : __disabled_formatter {};41 42# if _LIBCPP_STD_VER >= 2343 44template <class _Tp>45constexpr bool enable_nonlocking_formatter_optimization = false;46 47template <class _Tp>48_LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {49 if constexpr (requires { __formatter.set_debug_format(); })50 __formatter.set_debug_format();51}52 53# endif // _LIBCPP_STD_VER >= 2354#endif // _LIBCPP_STD_VER >= 2055 56_LIBCPP_END_NAMESPACE_STD57 58#endif // _LIBCPP___FORMAT_FORMATTER_H59